You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"source": "# If you don't want to give google access to drive you can skip this cell\n# and manually set `API_KEY` below.\n\nCOLAB = \"google.colab\" in str(get_ipython())\nif COLAB:\n !pip install colab-env -qU\n from colab_env import envvar_handler\n envvar_handler.envload()\n\nAPI_KEY = os.environ.get(\"LABELBOX_API_KEY\")\nif not os.environ.get(\"LABELBOX_API_KEY\"):\n API_KEY = getpass(\"Please enter your labelbox api key\")\n if COLAB:\n envvar_handler.add_env(\"LABELBOX_API_KEY\", API_KEY)"
"source": "PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\nDATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\nPROJECT_NAME = \"Sample Project\"\nDATASET_NAME = \"Example Jellyfish Dataset\"\n# Only update this if you have an on-prem deployment\nENDPOINT = \"https://api.labelbox.com/graphql\""
109
+
"source": [
110
+
"PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\n",
111
+
"DATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\n",
112
+
"PROJECT_NAME = \"Sample Project\"\n",
113
+
"DATASET_NAME = \"Example Jellyfish Dataset\"\n",
114
+
"# Only update this if you have an on-prem deployment\n",
"source": "# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n# Iterate over them to get the items out.\nnext(labels_paginated_collection)\n# list(paginated...) should be avoided for queries that could return more than a dozen results"
261
+
"source": [
262
+
"# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n",
263
+
"# Iterate over them to get the items out.\n",
264
+
"next(labels_paginated_collection)\n",
265
+
"# list(paginated...) should be avoided for queries that could return more than a dozen results"
266
+
]
238
267
},
239
268
{
240
269
"cell_type": "markdown",
@@ -263,7 +292,21 @@
263
292
]
264
293
}
265
294
],
266
-
"source": "datasets = client.get_datasets(where=Dataset.name == DATASET_NAME)\n\nprojects = client.get_projects(\n where=((Project.name == PROJECT_NAME) &\n (Project.description == \"new description field\")))\n\n# The above two queries return PaginatedCollections because the filter parameters aren't guaranteed to be unique.\n# So even if there is one element returned it is in a paginatedCollection.\nprint(projects)\nprint(next(projects, None))\nprint(next(projects, None))\nprint(next(projects, None))\n# We can see there is only one."
"# The above two queries return PaginatedCollections because the filter parameters aren't guaranteed to be unique.\n",
303
+
"# So even if there is one element returned it is in a paginatedCollection.\n",
304
+
"print(projects)\n",
305
+
"print(next(projects, None))\n",
306
+
"print(next(projects, None))\n",
307
+
"print(next(projects, None))\n",
308
+
"# We can see there is only one."
309
+
]
267
310
},
268
311
{
269
312
"cell_type": "markdown",
@@ -305,7 +348,11 @@
305
348
"output_type": "execute_result"
306
349
}
307
350
],
308
-
"source": "# Dataset has a Relationship to a Project so we can use the following\nlist(dataset.projects())\n# This will return all projects that are attached to this dataset"
351
+
"source": [
352
+
"# Dataset has a Relationship to a Project so we can use the following\n",
353
+
"list(dataset.projects())\n",
354
+
"# This will return all projects that are attached to this dataset"
0 commit comments