Data SDK Classes

All python classes utilized by the Data SDK are documented on this page.


DataConnector

A model representing a Studio data connector.

ArgumentTypeDescription
idstringThe unique identifier assigned to the data connector.
namestringThe data connector's name.
descriptionstringThe data connector's description.
typeDataConnectorTypeThe type of data connector.
created_atdatetimeThe time the data connector was initialized.
updated_atdatetimeThe time the data connector was last updated.

DataConnectorType

class DataConnectorType(str, Enum):
    SNOWFLAKE = "snowflake"
    BIG_QUERY = "big-query"
    ATHENA = "athena"
    POSTGRES = "postgres"
    PRESTO = "presto"
    REDSHIFT = "redshift"
    PLANET = "planet"
    EARTH_ENGINE = "earth-engine"
    S3 = "s3"
    GOOGLE_CLOUD_STORAGE = "google-cloud-storage"

Dataset

A model representing a Studio dataset.

ArgumentTypeDescription
idstringThe unique identifier assigned to the dataset.
namestringThe dataset's name.
typestringThe type of dataset.
created_atdatetimeThe time the dataset was initialized.
updated_atdatetimeThe time the dataset was last updated.
descriptionstringThe dataset's description.
is_validboolThe latest state of the map.
metadataDatasetMetadataA list of models representing Studio datasets.

Example

Dataset(
  id=UUID('6a097258-4d06-4402-b3e9-6869dd9c78b5'),
  name='states.csv',
  type=<DatasetType.MANAGED: 'managed'>,
  created_at=datetime.datetime(2023, 6, 15, 17, 23, 31, tzinfo=datetime.timezone.utc),
  updated_at=datetime.datetime(2023, 6, 15, 17, 23, 32, tzinfo=datetime.timezone.utc),
  description=None, is_valid=True,
  metadata=DatasetMetadata(
    media_type=<MediaType.CSV: 'text/csv'>,
    size=873,
    source=None,
    tileset_data_url=None,
    tileset_metadata_url=None,
    image_url=None,
    metadata_url=None,
    data_status=None
  )
)

DatasetMetadata

A model representing metadata for a Studio dataset.

ArgumentTypeDescription
media_typeUnion[MediaType,string]For tabular datasets, the format of the dataset.
sizeintThe size of the dataset in bytes.
sourcestringA source for the dataset, if it exists. Used in datasets that are created from other datasets, such as Hex Tiles.
tileset_data_urlstringFor tiled datasets, a source for the tile data.
tileset_metadata_urlstringFor tiled datasets, a source for the tile metadata.
image_urlstring
metadata_urlstring
data_statusstringThe processing status of a Hex Tile dataset.

Example

DatasetMetadata(
    media_type=<MediaType.CSV: 'text/csv'>,
    size=873,
    source=None,
    tileset_data_url=None,
    tileset_metadata_url=None,
    image_url=None,
    metadata_url=None,
    data_status=None
  )

Map

The map record object.

ArgumentTypeDescription
idstringRequired. The unique identifier assigned to the map.
namestringThe map's name.
descriptionstringThe map's description.
created_atdatetimeThe time the map was initialized.
updated_atdatetimeThe time the map was last updated.
latest_stateMapStateThe latest state of the map.
datasetsList[Dataset]A list of models representing Studio datasets.

Example

Map(id = UUID('7a739069-96b4-4cf0-b192-26ecaf05604f'),
    name = 'Untitled', description = '',
    created_at = datetime.datetime(2023, 6, 14, 22, 27, 42,
    tzinfo = datetime.timezone.utc),
    updated_at = datetime.datetime(2023, 6, 14, 22, 29, 26, tzinfo = datetime.timezone.utc),
    latest_state = MapState(id = UUID('5f9a5555-687a-431e-8bcf-544b4f48fc2f'),
    data = {
      'config': {
          'mapState': {
              'zoom': 2.928147705502598,
              'globe': {
                  'config': {
                      'water': True,
                      'labels': False,
                      'azimuth': False,
                      'basemap': True,
                      'surface': True,
                      'adminLines': True,
                      'atmosphere': True,
                      'terminator': True,
                      'waterColor': [17, 35, 48],
                      'labelsColor': [114.75, 114.75, 114.75],
                      'azimuthAngle': 45,
                      'surfaceColor': [9, 16, 29],
                      'adminLinesColor': [40, 63, 93],
                      'terminatorOpacity': 0.35
                  },
                  'enabled': False
              },
              'pitch': 0,
              'bearing': 0,
              'isSplit': False,
              'latitude': 30.655952993422108,
              'longitude': -77.45615389271373,
              'dragRotate': False,
              'mapViewMode': 'MODE_2D',
              'isZoomLocked': False,
              'mapSplitMode': 'SINGLE_MAP',
              'isViewportSynced': True,
              'splitMapViewports': []
          },
          'mapStyle': {
              'mapStyles': {},
              'styleType': 'dark',
              'topLayerGroups': {},
              'backgroundColor': [255, 255, 255],
              'visibleLayerGroups': {
                  'land': True,
                  'road': True,
                  'label': True,
                  'water': True,
                  'border': False,
                  'building': True,
                  '3d building': False
              },
              'threeDBuildingColor': [9.665468314072012, 17.18305478057247, 31.1442867897876]
          },
          'visState': {
              'joins': [],
              'charts': [],
              'editor': {
                  'visible': True,
                  'features': []
              },
              'layers': [{
                  'id': 'kcpug4j',
                  'type': 'geojson',
                  'config': {
                      'color': [137, 218, 193],
                      'label': 'State Geo',
                      'dataId': '654ab82a-9c1a-478d-b888-a27a30c860a9',
                      'hidden': False,
                      'columns': {
                          'geojson': 'State Geo'
                      },
                      'isVisible': True,
                      'textLabel': [{
                          'size': 18,
                          'color': [255, 255, 255],
                          'field': [],
                          'anchor': 'start',
                          'offset': [0, 0],
                          'alignment': 'center',
                          'background': False,
                          'outlineColor': [255, 0, 0, 255],
                          'outlineWidth': 0,
                          'backgroundColor': [0, 0, 200, 255]
                      }],
                      'visConfig': {
                          'filled': True,
                          'radius': 10,
                          'opacity': 0.8,
                          'stroked': False,
                          'enable3d': False,
                          'sizeRange': [0, 10],
                          'thickness': 0.5,
                          'wireframe': False,
                          'colorRange': {
                              'name': 'Global Warming',
                              'type': 'sequential',
                              'colors': ['#4C0035', '#880030', '#B72F15', '#D6610A', '#EF9100', '#FFC300'],
                              'category': 'Uber'
                          },
                          'fixedHeight': False,
                          'heightRange': [0, 500],
                          'radiusRange': [0, 50],
                          'strokeColor': None,
                          'strokeOpacity': 0.8,
                          'elevationScale': 5,
                          'strokeColorRange': {
                              'name': 'Global Warming',
                              'type': 'sequential',
                              'colors': ['#4C0035', '#880030', '#B72F15', '#D6610A', '#EF9100', '#FFC300'],
                              'category': 'Uber'
                          }
                      },
                      'columnMode': 'geojson'
                  },
                  'visualChannels': {
                      'sizeField': None,
                      'sizeScale': 'linear',
                      'colorField': {
                          'name': 'State',
                          'type': 'string'
                      },
                      'colorScale': 'ordinal',
                      'heightField': None,
                      'heightScale': 'linear',
                      'radiusField': None,
                      'radiusScale': 'linear',
                      'strokeColorField': None,
                      'strokeColorScale': 'quantile'
                  }
              }],
              'filters': [],
              'geoKeys': [{
                  'id': 'geoKey#8rq95549b',
                  'name': 'State',
                  'label': 'State Geometry',
                  'shape': 'simplified-boundary',
                  'dataId': '654ab82a-9c1a-478d-b888-a27a30c860a9',
                  'weight': 'none',
                  'geoType': None,
                  'targetColumnName': 'State Geo'
              }],
              'metrics': [],
              'analyses': [],
              'datasets': {
                  'datasetColors': {
                      '654ab82a-9c1a-478d-b888-a27a30c860a9': [143, 47, 191]
                  },
                  'fieldDisplayNames': {
                      '654ab82a-9c1a-478d-b888-a27a30c860a9': {}
                  },
                  'fieldDisplayFormats': {
                      '654ab82a-9c1a-478d-b888-a27a30c860a9': {}
                  }
              },
              'groupBys': [],
              'splitMaps': [],
              'layerOrder': ['kcpug4j'],
              'annotations': [],
              'layerBlending': 'normal',
              'projectColors': ['#000000', '#F7F8FA'],
              'animationConfig': {
                  'speed': 1,
                  'currentTime': None
              },
              'overlayBlending': 'normal',
              'interactionConfig': {
                  'brush': {
                      'size': 0.5,
                      'enabled': False
                  },
                  'tooltip': {
                      'enabled': True,
                      'compareMode': False,
                      'compareType': 'absolute',
                      'fieldsToShow': {
                          '654ab82a-9c1a-478d-b888-a27a30c860a9': [{
                              'name': 'State',
                              'format': None
                          }, {
                              'name': 'Abbreviation',
                              'format': None
                          }]
                      }
                  },
                  'geocoder': {
                      'enabled': False
                  },
                  'annotation': {
                      'enabled': True
                  },
                  'coordinate': {
                      'enabled': False
                  }
              }
          }
      },
      'version': 'v1'
  }), 
  datasets = 
  [
    Dataset(
    id = UUID('654ab82a-9c1a-478d-b888-a27a30c860a9'),
    name = 'states.csv', type = < DatasetType.MANAGED: 'managed' > ,
    created_at = datetime.datetime(2023, 6, 12, 18, 5, 48, tzinfo = datetime.timezone.utc),
    updated_at = datetime.datetime(2023, 6, 12, 18, 5, 51, tzinfo = datetime.timezone.utc),
    description = None, is_valid = True,
    metadata = DatasetMetadata(
      media_type = < MediaType.CSV: 'text/csv' > ,
      size = 873, source = None,
      tileset_data_url = None,
      tileset_metadata_url = None,
      image_url = None, metadata_url = None,
      data_status = None)
    )
  ]
)​​​​

MapState

The map state object. This is an important object containing the map configuration data.

ArgumentTypeDescription
idstringThe unique identifier assigned to the map.
datadictThe map configuration state represented as a dictionary. See the map configuration docs.

Example

 MapState(id = UUID('5f9a5555-687a-431e-8bcf-544b4f48fc2f'),
    data = {
      'config': {
          'mapState': {
              'zoom': 2.928147705502598,
              'globe': {
                  'config': {
                      'water': True,
                      'labels': False,
                      'azimuth': False,
                      'basemap': True,
                      'surface': True,
                      'adminLines': True,
                      'atmosphere': True,
                      'terminator': True,
                      'waterColor': [17, 35, 48],
                      'labelsColor': [114.75, 114.75, 114.75],
                      'azimuthAngle': 45,
                      'surfaceColor': [9, 16, 29],
                      'adminLinesColor': [40, 63, 93],
                      'terminatorOpacity': 0.35
                  },
                  'enabled': False
              },
              'pitch': 0,
              'bearing': 0,
              'isSplit': False,
              'latitude': 30.655952993422108,
              'longitude': -77.45615389271373,
              'dragRotate': False,
              'mapViewMode': 'MODE_2D',
              'isZoomLocked': False,
              'mapSplitMode': 'SINGLE_MAP',
              'isViewportSynced': True,
              'splitMapViewports': []
          },
          'mapStyle': {
              'mapStyles': {},
              'styleType': 'dark',
              'topLayerGroups': {},
              'backgroundColor': [255, 255, 255],
              'visibleLayerGroups': {
                  'land': True,
                  'road': True,
                  'label': True,
                  'water': True,
                  'border': False,
                  'building': True,
                  '3d building': False
              },
              'threeDBuildingColor': [9.665468314072012, 17.18305478057247, 31.1442867897876]
          },
          'visState': {
              'joins': [],
              'charts': [],
              'editor': {
                  'visible': True,
                  'features': []
              },
              'layers': [{
                  'id': 'kcpug4j',
                  'type': 'geojson',
                  'config': {
                      'color': [137, 218, 193],
                      'label': 'State Geo',
                      'dataId': '654ab82a-9c1a-478d-b888-a27a30c860a9',
                      'hidden': False,
                      'columns': {
                          'geojson': 'State Geo'
                      },
                      'isVisible': True,
                      'textLabel': [{
                          'size': 18,
                          'color': [255, 255, 255],
                          'field': [],
                          'anchor': 'start',
                          'offset': [0, 0],
                          'alignment': 'center',
                          'background': False,
                          'outlineColor': [255, 0, 0, 255],
                          'outlineWidth': 0,
                          'backgroundColor': [0, 0, 200, 255]
                      }],
                      'visConfig': {
                          'filled': True,
                          'radius': 10,
                          'opacity': 0.8,
                          'stroked': False,
                          'enable3d': False,
                          'sizeRange': [0, 10],
                          'thickness': 0.5,
                          'wireframe': False,
                          'colorRange': {
                              'name': 'Global Warming',
                              'type': 'sequential',
                              'colors': ['#4C0035', '#880030', '#B72F15', '#D6610A', '#EF9100', '#FFC300'],
                              'category': 'Uber'
                          },
                          'fixedHeight': False,
                          'heightRange': [0, 500],
                          'radiusRange': [0, 50],
                          'strokeColor': None,
                          'strokeOpacity': 0.8,
                          'elevationScale': 5,
                          'strokeColorRange': {
                              'name': 'Global Warming',
                              'type': 'sequential',
                              'colors': ['#4C0035', '#880030', '#B72F15', '#D6610A', '#EF9100', '#FFC300'],
                              'category': 'Uber'
                          }
                      },
                      'columnMode': 'geojson'
                  },
                  'visualChannels': {
                      'sizeField': None,
                      'sizeScale': 'linear',
                      'colorField': {
                          'name': 'State',
                          'type': 'string'
                      },
                      'colorScale': 'ordinal',
                      'heightField': None,
                      'heightScale': 'linear',
                      'radiusField': None,
                      'radiusScale': 'linear',
                      'strokeColorField': None,
                      'strokeColorScale': 'quantile'
                  }
              }],
              'filters': [],
              'geoKeys': [{
                  'id': 'geoKey#8rq95549b',
                  'name': 'State',
                  'label': 'State Geometry',
                  'shape': 'simplified-boundary',
                  'dataId': '654ab82a-9c1a-478d-b888-a27a30c860a9',
                  'weight': 'none',
                  'geoType': None,
                  'targetColumnName': 'State Geo'
              }],
              'metrics': [],
              'analyses': [],
              'datasets': {
                  'datasetColors': {
                      '654ab82a-9c1a-478d-b888-a27a30c860a9': [143, 47, 191]
                  },
                  'fieldDisplayNames': {
                      '654ab82a-9c1a-478d-b888-a27a30c860a9': {}
                  },
                  'fieldDisplayFormats': {
                      '654ab82a-9c1a-478d-b888-a27a30c860a9': {}
                  }
              },
              'groupBys': [],
              'splitMaps': [],
              'layerOrder': ['kcpug4j'],
              'annotations': [],
              'layerBlending': 'normal',
              'projectColors': ['#000000', '#F7F8FA'],
              'animationConfig': {
                  'speed': 1,
                  'currentTime': None
              },
              'overlayBlending': 'normal',
              'interactionConfig': {
                  'brush': {
                      'size': 0.5,
                      'enabled': False
                  },
                  'tooltip': {
                      'enabled': True,
                      'compareMode': False,
                      'compareType': 'absolute',
                      'fieldsToShow': {
                          '654ab82a-9c1a-478d-b888-a27a30c860a9': [{
                              'name': 'State',
                              'format': None
                          }, {
                              'name': 'Abbreviation',
                              'format': None
                          }]
                      }
                  },
                  'geocoder': {
                      'enabled': False
                  },
                  'annotation': {
                      'enabled': True
                  },
                  'coordinate': {
                      'enabled': False
                  }
              }
          }
      },
      'version': 'v1'
  })

MediaType

Data formats currently supported by Data SDK:

class MediaType(str, Enum):
    CSV = "text/csv"
    GEOJSON = "application/geo+json"
    JSON = "application/json"
    FGB = "application/x.flatgeobuf"