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\""
110
+
"source": [
111
+
"PROJECT_ID = \"ckk4q1viuc0w20704eh69u28h\"\n",
112
+
"DATASET_ID = \"ckk4q1vjznyhu087203wlghfr\"\n",
113
+
"PROJECT_NAME = \"Sample Project\"\n",
114
+
"DATASET_NAME = \"Example Jellyfish Dataset\"\n",
115
+
"# 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"
263
+
"source": [
264
+
"# Note that if you selected a `project_id` without any labels this will raise `StopIteration`\n",
265
+
"# Iterate over them to get the items out.\n",
266
+
"next(labels_paginated_collection)\n",
267
+
"# list(paginated...) should be avoided for queries that could return more than a dozen results"
268
+
]
238
269
},
239
270
{
240
271
"cell_type": "markdown",
@@ -263,7 +294,21 @@
263
294
]
264
295
}
265
296
],
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",
305
+
"# So even if there is one element returned it is in a paginatedCollection.\n",
306
+
"print(projects)\n",
307
+
"print(next(projects, None))\n",
308
+
"print(next(projects, None))\n",
309
+
"print(next(projects, None))\n",
310
+
"# We can see there is only one."
311
+
]
267
312
},
268
313
{
269
314
"cell_type": "markdown",
@@ -305,7 +350,11 @@
305
350
"output_type": "execute_result"
306
351
}
307
352
],
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"
353
+
"source": [
354
+
"# Dataset has a Relationship to a Project so we can use the following\n",
355
+
"list(dataset.projects())\n",
356
+
"# This will return all projects that are attached to this dataset"
0 commit comments