Common SDK methods

Cheatsheet for most common Python SDK methods for dataset management

Dataset CRUD actions

from labelbox import Client

client = Client()

## Create a new dataset
dataset = client.create_dataset(name="Tutorial")

## Get existing dataset
dataset = client.get_dataset("DATASET_ID")

## Get contents
print(dataset.name)


## Update dataset name and description
dataset.update(name="New name", description="New description")

## Delete a dataset
dataset.delete()

Bulk create Data Rows

Wherever possible use bulk methods to create faster and more reliable connections to Labelbox

from uuid import uuid4

dataset = client.create_dataset(name="Bulk import example")

assets = [{"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())},
         {"row_data": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/basic.jpg", "external_id": str(uuid4())}]

asset_attachments = [{"type": "IMAGE_OVERLAY", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/rgb.jpg"},
                       {"type": "IMAGE_OVERLAY", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/cir.jpg"},
                       {"type": "IMAGE_OVERLAY", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/weeds.jpg"},
                       {"type": "TEXT", "value": "IOWA, Zone 2232, June 2022 [Text string]"},
                       {"type": "TEXT", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/text_attachment.txt"},
                       {"type": "IMAGE", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/disease_attachment.jpeg"},
                       {"type": "VIDEO", "value":  "https://storage.googleapis.com/labelbox-sample-datasets/Docs/drone_video.mp4"},
                       {"type": "HTML", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/windy.html"}]

for item in assets:
  item["attachments"] = asset_attachments

task = dataset.create_data_rows(assets)
task.wait_till_done()
from uuid import uuid4
from labelbox import DataRow

dataset = client.create_dataset(name="Geospatial bulk import example")

payload = [
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.405662413477728,-99.21052827588443],[19.400498983095076,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.400498983095076,-99.21052827588443],[19.39533555271248,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.39533555271248,-99.21052827588443],[19.39017212232983,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.39017212232983,-99.21052827588443],[19.385008691947178,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.385008691947178,-99.21052827588443],[19.379845261564526,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.379845261564526,-99.21052827588443],[19.37468183118193,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.37468183118193,-99.21052827588443],[19.36951840079928,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.36951840079928,-99.21052827588443],[19.364354970416628,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.364354970416628,-99.21052827588443],[19.359191540033805,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.359191540033805,-99.21052827588443],[19.354028109651153,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.405662413477728,-99.20534818927473],[19.400498983095076,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.400498983095076,-99.20534818927473],[19.39533555271248,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.39533555271248,-99.20534818927473],[19.39017212232983,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.39017212232983,-99.20534818927473],[19.385008691947178,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.385008691947178,-99.20534818927473],[19.379845261564526,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.379845261564526,-99.20534818927473],[19.37468183118193,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.37468183118193,-99.20534818927473],[19.36951840079928,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.36951840079928,-99.20534818927473],[19.364354970416628,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.364354970416628,-99.20534818927473],[19.359191540033805,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.359191540033805,-99.20534818927473],[19.354028109651153,-99.20016810266503]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.405662413477728,-99.20016810266503],[19.400498983095076,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.400498983095076,-99.20016810266503],[19.39533555271248,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.39533555271248,-99.20016810266503],[19.39017212232983,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.39017212232983,-99.20016810266503],[19.385008691947178,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.385008691947178,-99.20016810266503],[19.379845261564526,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.379845261564526,-99.20016810266503],[19.37468183118193,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.37468183118193,-99.20016810266503],[19.36951840079928,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.36951840079928,-99.20016810266503],[19.364354970416628,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.364354970416628,-99.20016810266503],[19.359191540033805,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]},
          {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.359191540033805,-99.20016810266503],[19.354028109651153,-99.19498801605533]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]}]
          

asset_attachments = [{"type": "TEXT", "value": "Mexico"},
                     {"type": "IMAGE", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/mexico_city.jpeg"},
                     {"type": "HTML", "value": "https://storage.googleapis.com/labelbox-sample-datasets/Docs/google_maps_mexico.html"}]

processed_payload = []
for item in payload:
  item["external_id"] = str(uuid4())
  item["attachments"] = asset_attachments
  processed_payload.append({DataRow.row_data: json.dumps(item), DataRow.external_id: str(uuid4())})


task = dataset.create_data_rows(processed_payload)
task.wait_till_done()

Read, update and delete Data Row

## Fetch a single datarow
data_row = client.get_data_row("<data-row-id>")

## Useful for resigning urls
data_row.update(row_data="https://storage.googleapis.com/labelbox-sample-datasets/Docs/cir.jpg")

## Useful for renaming external ids or signed URLs
data_row.update(external_id="new_external_id")

## Delete
data_row.delete()
import json
from uuid import uuid4
from labelbox import DataRow

#Geospatial and custom editors often need more than asset URL. You can pass JSON payload in row_data
payload = {"tileLayerUrl":"https://s3-us-east-2.amazonaws.com/lb-ron/CACI/ron_mctiles/{z}/{x}/{y}.png","bounds":[[19.405662413477728,-99.21052827588443],[19.400498983095076,-99.20534818927473]],"minZoom":12,"maxZoom":20,"epsg":"EPSG4326","alternativeLayers":[{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Satellite"},{"tileLayerUrl":"https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-night-v4/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw","name":"Guidance"}]}
data_row = dataset.create_data_row(row_data=json.dumps(payload))

#Create attachments
data_row.create_attachment(attachment_type="TEXT", attachment_value="Mexico")
data_row.create_attachment(attachment_type="IMAGE", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/mexico_city.jpeg")
data_row.create_attachment(attachment_type="HTML", attachment_value="https://storage.googleapis.com/labelbox-sample-datasets/Docs/google_maps_mexico.html")

Complete Python SDK tutorial

The tutorials below cover a few more Data Rows and Datasets methods.

TutorialGithubGoogle Colab
Data RowsOpen In GithubOpen In Colab
DatasetsOpen In GithubOpen In Colab