carto package API documentation¶
carto.auth module¶
Module for authenticated access to CARTO’s APIs
-
class
carto.auth.
APIKeyAuthClient
(base_url, api_key, organization=None, session=None)¶ Bases:
pyrestcli.auth.BaseAuthClient
This class provides you with authenticated access to CARTO’s APIs using your API key.
You can find your API key by clicking on the API key section of the user dropdown menu
-
get_user_name
(base_url)¶
-
prepare_send
(http_method, **requests_args)¶
-
send
(relative_path, http_method, **requests_args)¶ Makes an API-key-authorized request
Parameters: - relative_path (str) – URL path relative to self.base_url
- http_method (str) – HTTP method
- requests_args (kwargs) – kwargs to be sent to requests
Returns: A request response object
Raise: CartoException
-
-
class
carto.auth.
NonVerifiedAPIKeyAuthClient
(base_url, api_key, organization=None, session=None)¶ Bases:
carto.auth.APIKeyAuthClient
This class provides you with authenticated access to CARTO’s APIs using your API key but avoids verifying SSL certificates. This is useful for onpremises instances of CARTO
You can find your API key by clicking on the API key section of the user dropdown menu
-
send
(relative_path, http_method, **requests_args)¶ Makes an API-key-authorized request not verifying SSL certs
Parameters: - relative_path (str) – URL path relative to self.base_url
- http_method (str) – HTTP method
- requests_args (kwargs) – kwargs to be sent to requests
Returns: A request response object
Raise: CartoException
-
carto.datasets module¶
Module for working with CARTO datasets
-
class
carto.datasets.
Dataset
(auth_client, **kwargs)¶ Bases:
carto.resources.WarnResource
Represents a dataset in CARTO. Typically, that means there is a table in the PostgreSQL server associated to this object.
Warning
Non-public API. It may change with no previous notice
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/viz/'¶
-
id_field
= 'id'¶
-
json_data
= True¶
-
name_field
= 'name'¶
-
parse_json
= True¶
-
-
Dataset.
active_child
= None¶
-
Dataset.
active_layer_id
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
attributions
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
auth_tokens
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
children
= None¶
-
Dataset.
connector
= None¶
-
Dataset.
created_at
¶ Field to store datetimes in resources
-
Dataset.
description
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
display_name
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
external_source
= None¶
-
Dataset.
fields
= ['liked', 'likes', 'active_layer_id', 'table', 'display_name', 'privacy', 'permission', 'id', 'parent_id', 'type', 'map_id', 'description', 'tags', 'updated_at', 'attributions', 'user', 'stats', 'kind', 'locked', 'name', 'license', 'url', 'created_at', 'uses_builder_features', 'auth_tokens', 'title']¶
-
Dataset.
id
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
kind
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
license
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
liked
¶ Convenient class to make explicit that an attribute will store booleans
-
Dataset.
likes
¶ Convenient class to make explicit that an attribute will store integers
-
Dataset.
locked
¶ Convenient class to make explicit that an attribute will store booleans
-
Dataset.
map_id
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
name
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
next_id
= None¶
-
Dataset.
parent_id
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
permission
¶
-
Dataset.
prev_id
= None¶
-
Dataset.
privacy
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
source
= None¶
-
Dataset.
stats
¶ Field to store datetimes in resources
-
Dataset.
synchronization
= None¶
-
Dataset.
table
¶
Convenient class to make explicit that an attribute will store chars
-
Dataset.
title
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
transition_options
= None¶
-
Dataset.
type
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
updated_at
¶ Field to store datetimes in resources
-
Dataset.
url
¶ Convenient class to make explicit that an attribute will store chars
-
Dataset.
user
¶
-
Dataset.
uses_builder_features
¶ Convenient class to make explicit that an attribute will store booleans
-
class
-
class
carto.datasets.
DatasetManager
(auth_client)¶ Bases:
carto.resources.Manager
Manager for the Dataset class.
Warning
Non-public API. It may change with no previous notice
-
create
(archive, interval=None, **import_args)¶ Creating a table means uploading a file or setting up a sync table
Parameters: - archive (str) – URL to the file (both remote URLs or local paths are supported) or StringIO object
- interval (int) – Interval in seconds. If not None, CARTO will try to set up a sync table against the (remote) URL
- import_args (kwargs) – Arguments to be sent to the import job when run
Returns: New dataset object
Return type: Raise: CartoException
-
is_sync_table
(archive, interval, **import_args)¶ Checks if this is a request for a sync dataset.
The condition for creating a sync dataset is to provide a URL or a connection to an external database and an interval in seconds
Parameters: - archive – URL to the file (both remote URLs or local paths are supported) or StringIO object
- interval (int) – Interval in seconds.
- import_args (kwargs) – Connection parameters for an external database
Returns: True if it is a sync dataset
-
json_collection_attribute
= 'visualizations'¶
-
paginator_class
¶ alias of
CartoPaginator
-
send
(url, http_method, **client_args)¶ Sends an API request, taking into account that datasets are part of the visualization endpoint.
Parameters: - url (str) – Endpoint URL
- http_method (str) – The method used to make the request to the API
- client_args (kwargs) – Arguments to be sent to the auth client
Returns: A request response object
Raise: CartoException
-
carto.exceptions module¶
Module for carto-python exceptions definitions
-
exception
carto.exceptions.
CartoException
¶ Bases:
exceptions.Exception
Any Exception produced by carto-python should be wrapped around this class
carto.export module¶
Module for exporting visualizations
-
class
carto.export.
ExportJob
(client, visualization_id)¶ Bases:
carto.resources.WarnAsyncResource
Equivalent to a .carto export in CARTO.
Allows a CARTO export to be created using a visualization in the user’s CARTO account
Warning
Non-public API. It may change with no previous notice
-
class
Meta
¶ -
collection_endpoint
= 'api/v3/visualization_exports/'¶
-
id_field
= 'id'¶
-
json_data
= True¶
-
name_field
= 'id'¶
-
parse_json
= True¶
-
-
ExportJob.
created_at
¶ Field to store datetimes in resources
-
ExportJob.
fields
= ['user_id', 'url', 'created_at', 'updated_at', 'state', 'visualization_id', 'id']¶
-
ExportJob.
id
¶ Convenient class to make explicit that an attribute will store chars
-
ExportJob.
run
(**export_params)¶ Make the actual request to the Import API (exporting is part of the Import API).
Parameters: export_params (kwargs) – Any additional parameters to be sent to the Import API Returns: Note
The export is asynchronous, so you should take care of the progression, by calling the
carto.resources.AsyncResource.refresh()
method and check the export jobstate
attribute. Seecarto.visualizations.Visualization.export()
method implementation for more details
-
ExportJob.
state
¶ Convenient class to make explicit that an attribute will store chars
-
ExportJob.
updated_at
¶ Field to store datetimes in resources
-
ExportJob.
url
¶ Convenient class to make explicit that an attribute will store chars
-
ExportJob.
user_id
¶ Convenient class to make explicit that an attribute will store chars
-
ExportJob.
visualization_id
¶ Convenient class to make explicit that an attribute will store chars
-
class
carto.fields module¶
Module for defining response objects
-
class
carto.fields.
EntityField
(many=False)¶ Bases:
pyrestcli.fields.ResourceField
-
value_class
= 'carto.permissions.Entity'¶
-
-
class
carto.fields.
PermissionField
(many=False)¶ Bases:
pyrestcli.fields.ResourceField
-
value_class
= 'carto.permissions.Permission'¶
-
-
class
carto.fields.
TableField
(many=False)¶ Bases:
pyrestcli.fields.ResourceField
-
value_class
= 'carto.tables.Table'¶
-
-
class
carto.fields.
UserField
(many=False)¶ Bases:
pyrestcli.fields.ResourceField
-
value_class
= 'carto.users.User'¶
-
-
class
carto.fields.
VisualizationField
(many=False)¶ Bases:
pyrestcli.fields.ResourceField
carto.visualizations.Visualization
-
value_class
= 'carto.visualizations.Visualization'¶
-
carto.file_import module¶
Module for importing remote and local files into CARTO
-
class
carto.file_import.
FileImportJob
(archive, auth_client)¶ Bases:
carto.resources.AsyncResource
This class provides support for one-time uploading and importing of remote and local files into CARTO
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/imports/'¶
-
id_field
= 'item_queue_id'¶
-
json_data
= True¶
-
name_field
= 'id'¶
-
parse_json
= True¶
-
-
FileImportJob.
content_guessing
¶ Convenient class to make explicit that an attribute will store booleans
-
FileImportJob.
create_visualization
¶ Convenient class to make explicit that an attribute will store booleans
-
FileImportJob.
data_type
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
display_name
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
error_code
¶ Convenient class to make explicit that an attribute will store integers
-
FileImportJob.
fields
= ['quoted_fields_guessing', 'data_type', 'queue_id', 'user_defined_limits', 'item_queue_id', 'type_guessing', 'display_name', 'visualization_id', 'id', 'content_guessing', 'user_id', 'create_visualization', 'success', 'table_id', 'synchronization_id', 'is_raster', 'state', 'table_name', 'tables_created_count', 'error_code']¶
-
FileImportJob.
get_error_text
= None¶
-
FileImportJob.
id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
is_raster
¶ Convenient class to make explicit that an attribute will store booleans
-
FileImportJob.
item_queue_id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
queue_id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
quoted_fields_guessing
¶ Convenient class to make explicit that an attribute will store booleans
-
FileImportJob.
run
(**import_params)¶ Actually creates the import job on the CARTO server
Parameters: import_params (kwargs) – To be send to the Import API, see CARTO’s docs on Import API for an updated list of accepted params Returns: Note
The import job is asynchronous, so you should take care of the progression, by calling the
carto.resources.AsyncResource.refresh()
method and check the import jobstate
attribute. Seecarto.datasets.DatasetManager.create()
for a unified method to import files into CARTO
-
FileImportJob.
state
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
success
¶ Convenient class to make explicit that an attribute will store booleans
-
FileImportJob.
synchronization_id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
table_id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
table_name
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
tables_created_count
¶ Convenient class to make explicit that an attribute will store integers
-
FileImportJob.
type_guessing
¶ Convenient class to make explicit that an attribute will store booleans
-
FileImportJob.
user_defined_limits
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
user_id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
visualization_id
¶ Convenient class to make explicit that an attribute will store chars
-
FileImportJob.
warnings
= None¶
-
class
-
class
carto.file_import.
FileImportJobManager
(auth_client)¶ Bases:
carto.resources.Manager
-
create
(archive, **kwargs)¶ Creates a file import on the server
Parameters: - archive (str) – archive can be a pointer to a remote location, a path to a local file or a StringIO object
- kwargs (kwargs) – Attributes (field names and values) of the new resource
Returns:
-
filter
()¶ Get a filtered list of file imports
Returns: A list of file imports, with only the id set (you need to refresh them if you want all the attributes to be filled in) Return type: list of carto.file_import.FileImportJob
Raise: CartoException
-
json_collection_attribute
= 'imports'¶
-
paginator_class
¶ alias of
CartoPaginator
-
resource_class
¶ alias of
FileImportJob
-
carto.maps module¶
Module for working with named and anonymous maps
-
class
carto.maps.
AnonymousMap
(auth_client)¶ Bases:
carto.maps.BaseMap
Equivalent to creating an anonymous map in CARTO.
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/map/'¶
-
id_field
= 'id'¶
-
json_data
= True¶
-
name_field
= 'id'¶
-
parse_json
= True¶
-
-
AnonymousMap.
fields
= []¶
-
AnonymousMap.
instantiate
(params)¶ Allows you to fetch the map tiles of a created map
Parameters: params (dict) – The json with the styling info for the named map Returns: Raise: CartoException
-
AnonymousMap.
update_from_dict
(attribute_dict)¶
-
class
-
class
carto.maps.
BaseMap
(auth_client)¶ Bases:
pyrestcli.resources.Resource
Base class for NamedMap and AnonymousMap
-
fields
= []¶
-
get_tile_url
(x, y, z, layer_id=None, feature_id=None, filter=None, extension='png')¶ Prepares a URL to get data (raster or vector) from a NamedMap or AnonymousMap
Parameters: - x (int) – The x tile
- y (int) – The y tile
- z (int) – The zoom level
- layer_id (str) – Can be a number (referring to the # layer of your map), all layers of your map, or a list of layers. To show just the basemap layer, enter the value 0 To show the first layer, enter the value 1 To show all layers, enter the value ‘all’ To show a list of layers, enter the comma separated layer value as ‘0,1,2’
- feature_id (str) – The id of the feature
- filter (str) – The filter to be applied to the layer
- extension (str) – The format of the data to be retrieved: png, mvt, ...
Returns: A URL to download data
Return type: str
Raise: CartoException
-
-
class
carto.maps.
NamedMap
(auth_client)¶ Bases:
carto.maps.BaseMap
Equivalent to creating a named map in CARTO.
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/map/named/'¶
-
id_field
= 'template_id'¶
-
json_data
= True¶
-
name_field
= 'name'¶
-
parse_json
= True¶
-
-
NamedMap.
fields
= []¶
-
NamedMap.
instantiate
(params, auth=None)¶ Allows you to fetch the map tiles of a created map
Parameters: - params (dict) – The json with the styling info for the named map
- auth (
carto.auth.APIKeyAuthClient
) – The auth client
Returns: Raise: CartoException
-
NamedMap.
update_from_dict
(attribute_dict)¶ Method overriden from the base class
-
class
-
class
carto.maps.
NamedMapManager
(auth_client)¶ Bases:
pyrestcli.resources.Manager
Manager for the NamedMap class
-
create
(**kwargs)¶ Creates a named map
Parameters: kwargs (kwargs) – Attributes for creating the named map. Specifically an attribute template must contain the JSON object defining the named map Returns: New named map object Return type: NamedMap Raise: CartoException
-
json_collection_attribute
= 'template_ids'¶
-
carto.paginators module¶
Used internally to retrieve results paginated
carto.permissions module¶
Entity classes for defining permissions
-
class
carto.permissions.
Entity
(auth_client, **kwargs)¶ Bases:
pyrestcli.resources.Resource
Represents an entity in CARTO. This is an internal data type, with no specific API endpoints
-
fields
= ['type', 'id']¶
-
id
¶ Convenient class to make explicit that an attribute will store chars
-
type
¶ Convenient class to make explicit that an attribute will store chars
-
-
class
carto.permissions.
Permission
(auth_client, **kwargs)¶ Bases:
pyrestcli.resources.Resource
Represents a permission in CARTO. This is an internal data type, with no specific API endpoints
-
acl
= None¶
-
created_at
¶ Field to store datetimes in resources
-
entity
¶
-
fields
= ['created_at', 'updated_at', 'entity', 'id', 'owner']¶
-
id
¶ Convenient class to make explicit that an attribute will store chars
-
owner
¶
-
updated_at
¶ Field to store datetimes in resources
-
carto.resources module¶
Extensions for pyrestcli Resource and Manager classes
-
class
carto.resources.
AsyncResource
(auth_client, **kwargs)¶ Bases:
pyrestcli.resources.Resource
-
fields
= []¶
-
refresh
()¶ Updates the information of the async job against the CARTO server. After calling the
refresh()
method you should check the state attribute of your resourceReturns:
-
run
(**client_params)¶ Actually creates the async job on the CARTO server
Parameters: client_params (kwargs) – To be send to the CARTO API. See CARTO’s documentation depending on the subclass you are using Returns: Raise: CartoException
-
-
class
carto.resources.
Manager
(auth_client)¶ Bases:
pyrestcli.resources.Manager
Manager class for resources
-
class
carto.resources.
WarnAsyncResource
(auth_client, **kwargs)¶ Bases:
carto.resources.AsyncResource
AsyncResource class for resources that represent non-public CARTO APIs. You’ll be warned not to used the in production environments
-
fields
= []¶
-
carto.sql module¶
Module for the SQL API
-
class
carto.sql.
BatchSQLClient
(client, api_version='v2')¶ Bases:
object
Allows you to send requests to CARTO’s Batch SQL API
-
cancel
(job_id)¶ Cancels a job
Parameters: job_id (str) – The id of the job to be cancelled Returns: A status code depending on whether the cancel request was successful Return type: str Raises: CartoException –
-
create
(sql_query)¶ Creates a new batch SQL query.
Batch SQL jobs are asynchronous, once created you should call
carto.sql.BatchSQLClient.read()
method given the job_id to retrieve the state of the batch queryParameters: sql_query (str or list of str) – The SQL query to be used Returns: Response data, either as json or as a regular response.content object Return type: object Raise: CartoException
-
read
(job_id)¶ Reads the information for a specific Batch API request
Parameters: job_id (str) – The id of the job to be read from Returns: Response data, either as json or as a regular response.content object Return type: object Raise: CartoException
-
send
(url, http_method, json_body=None, http_header=None)¶ Executes Batch SQL query in a CARTO server
Parameters: - url (str) – Endpoint url
- http_method (str) – The method used to make the request to the API
- json_body (dict) – The information that needs to be sent, by default is set to None
- http_header (str) – The header used to make write requests to the API, by default is none
Returns: Response data, either as json or as a regular response.content object
Return type: object
Raise: CartoException
-
update
(job_id, sql_query)¶ Updates the sql query of a specific job
Parameters: - job_id (str) – The id of the job to be updated
- sql_query (str) – The new SQL query for the job
Returns: Response data, either as json or as a regular response.content object
Return type: object
Raise: CartoException
-
update_from_dict
(data_dict)¶ Parameters: data_dict (dict) – Dictionary to be mapped into object attributes Returns:
-
-
class
carto.sql.
SQLClient
(auth_client, api_version='v2')¶ Bases:
object
Allows you to send requests to CARTO’s SQL API
-
send
(sql, parse_json=True, do_post=True, format=None, **request_args)¶ Executes SQL query in a CARTO server
Parameters: - sql (str) – The SQL
- parse_json (boolean) – Set it to False if you want raw reponse
- do_post (boolean) – Set it to True to force post request
- format (str) – Any of the data export formats allowed by CARTO’s SQL API
- request_args (dictionary) – Additional parameters to send with the request
Returns: response data, either as json or as a regular response.content object
Return type: object
Raise: CartoException
-
carto.sync_tables module¶
Module for the IMPORT API with sync tables
-
class
carto.sync_tables.
SyncTableJob
(url, interval, auth_client)¶ Bases:
carto.resources.AsyncResource
This class provides support for creating Sync Tables into CARTO
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/synchronizations/'¶
-
id_field
= 'id'¶
-
json_data
= True¶
-
name_field
= 'id'¶
-
parse_json
= True¶
-
-
SyncTableJob.
checksum
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
content_guessing
¶ Convenient class to make explicit that an attribute will store booleans
-
SyncTableJob.
created_at
¶ Field to store datetimes in resources
-
SyncTableJob.
enqueued
¶ Convenient class to make explicit that an attribute will store booleans
-
SyncTableJob.
error_code
¶ Convenient class to make explicit that an attribute will store integers
-
SyncTableJob.
error_message
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
etag
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
fields
= ['interval', 'service_name', 'updated_at', 'run_at', 'type_guessing', 'service_item_id', 'id', 'ran_at', 'user_id', 'synchronization_id', 'state', 'etag', 'quoted_fields_guessing', 'from_external_source', 'visualization_id', 'content_guessing', 'name', 'success', 'url', 'checksum', 'created_at', 'error_message', 'modified_at', 'enqueued', 'log_id', 'retried_times', 'error_code']¶
-
SyncTableJob.
force_sync
()¶ Forces to sync the SyncTableJob
Returns: Raise: CartoException
-
SyncTableJob.
from_external_source
¶ Convenient class to make explicit that an attribute will store booleans
-
SyncTableJob.
get_force_sync_endpoint
()¶ Get the relative path to the specific API resource
Returns: Relative path to the resource Raise: CartoException
-
SyncTableJob.
id
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
interval
¶ Convenient class to make explicit that an attribute will store integers
-
SyncTableJob.
log_id
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
modified_at
¶ Field to store datetimes in resources
-
SyncTableJob.
name
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
quoted_fields_guessing
¶ Convenient class to make explicit that an attribute will store booleans
-
SyncTableJob.
ran_at
¶ Field to store datetimes in resources
-
SyncTableJob.
retried_times
¶ Convenient class to make explicit that an attribute will store integers
-
SyncTableJob.
run
(**import_params)¶ Actually creates the job import on the CARTO server
Parameters: import_params (kwargs) – To be send to the Import API, see CARTO’s docs on Import API for an updated list of accepted params Returns: Note
The sync table job is asynchronous, so you should take care of the progression, by calling the
carto.resources.AsyncResource.refresh()
method and check the import jobstate
attribute. Seecarto.datasets.DatasetManager.create()
for a unified method to import files into CARTO
-
SyncTableJob.
run_at
¶ Field to store datetimes in resources
-
SyncTableJob.
service_item_id
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
service_name
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
state
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
success
¶ Convenient class to make explicit that an attribute will store booleans
-
SyncTableJob.
synchronization_id
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
type_guessing
¶ Convenient class to make explicit that an attribute will store booleans
-
SyncTableJob.
updated_at
¶ Field to store datetimes in resources
-
SyncTableJob.
url
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
user_id
¶ Convenient class to make explicit that an attribute will store chars
-
SyncTableJob.
visualization_id
¶ Convenient class to make explicit that an attribute will store chars
-
class
-
class
carto.sync_tables.
SyncTableJobManager
(auth_client)¶ Bases:
carto.resources.Manager
Manager for the SyncTableJob class
-
create
(url, interval, **kwargs)¶ Create a sync table on the server
Parameters: - url (str) – URL can be a pointer to a remote location or a path to a local file
- interval (int) – Sync interval in seconds
- kwargs (kwargs) – Attributes (field names and values) of the new resource
Returns: SyncTableJob
-
json_collection_attribute
= 'synchronizations'¶
-
paginator_class
¶ alias of
CartoPaginator
-
resource_class
¶ alias of
SyncTableJob
-
carto.tables module¶
Module for working with tables
-
class
carto.tables.
Table
(auth_client, **kwargs)¶ Bases:
carto.resources.WarnResource
Represents a table in CARTO. This is an internal data type. Both Table and TableManager are not meant to be used outside the SDK
If you are looking to work with datasets / tables from outside the SDK, please look into the datasets.py file.
Warning
Non-public API. It may change with no previous notice
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/tables/'¶
-
id_field
= 'id'¶
-
json_data
= True¶
-
name_field
= 'name'¶
-
parse_json
= True¶
-
-
Table.
dependent_visualizations
= None¶
-
Table.
description
¶ Convenient class to make explicit that an attribute will store chars
-
Table.
fields
= ['rows_counted', 'map_id', 'description', 'permission', 'geometry_types', 'updated_at', 'table_size', 'id', 'size', 'name', 'privacy', 'row_count', 'table_visualization']¶
-
Table.
geometry_types
¶ Convenient class to make explicit that an attribute will store chars
-
Table.
id
¶ Convenient class to make explicit that an attribute will store chars
-
Table.
map_id
¶ Convenient class to make explicit that an attribute will store chars
-
Table.
name
¶ Convenient class to make explicit that an attribute will store chars
-
Table.
non_dependent_visualizations
= None¶
-
Table.
permission
¶
-
Table.
privacy
¶ Convenient class to make explicit that an attribute will store chars
-
Table.
row_count
¶ Convenient class to make explicit that an attribute will store integers
-
Table.
rows_counted
¶ Convenient class to make explicit that an attribute will store integers
-
Table.
schema
= None¶
-
Table.
size
¶ Convenient class to make explicit that an attribute will store integers
-
Table.
synchronization
= None¶
-
Table.
table_size
¶ Convenient class to make explicit that an attribute will store integers
-
Table.
table_visualization
¶
-
Table.
updated_at
¶ Field to store datetimes in resources
-
class
-
class
carto.tables.
TableManager
(auth_client)¶ Bases:
carto.resources.Manager
Manager for the Table class.
Warning
Non-public API. It may change with no previous notice
-
paginator_class
¶ alias of
CartoPaginator
-
carto.users module¶
Module for working with users
-
class
carto.users.
User
(auth_client)¶ Bases:
carto.resources.WarnResource
Represents an enterprise CARTO user, i.e. a user that belongs to an organization
Currently, CARTO’s user API only supports enterprise users.
Warning
Non-public API. It may change with no previous notice
-
class
Meta
¶ -
collection_endpoint
= None¶
-
id_field
= 'username'¶
-
json_data
= True¶
-
name_field
= 'username'¶
-
parse_json
= True¶
-
-
User.
all_visualization_count
¶ Convenient class to make explicit that an attribute will store integers
-
User.
avatar_url
¶ Convenient class to make explicit that an attribute will store chars
-
User.
base_url
¶ Convenient class to make explicit that an attribute will store chars
-
User.
db_size_in_bytes
¶ Convenient class to make explicit that an attribute will store integers
-
User.
email
¶ Convenient class to make explicit that an attribute will store chars
-
User.
fields
= ['username', 'avatar_url', 'table_count', 'public_visualization_count', 'soft_geocoding_limit', 'all_visualization_count', 'password', 'db_size_in_bytes', 'quota_in_bytes', 'base_url', 'email']¶
-
User.
get_collection_endpoint
()¶
-
User.
get_resource_endpoint
()¶
-
User.
password
¶ Convenient class to make explicit that an attribute will store chars
-
User.
public_visualization_count
¶ Convenient class to make explicit that an attribute will store integers
-
User.
quota_in_bytes
¶ Convenient class to make explicit that an attribute will store integers
-
User.
soft_geocoding_limit
¶ Convenient class to make explicit that an attribute will store integers
-
User.
table_count
¶ Convenient class to make explicit that an attribute will store integers
-
User.
username
¶ Convenient class to make explicit that an attribute will store chars
-
class
-
class
carto.users.
UserManager
(auth_client)¶ Bases:
carto.resources.Manager
Manager for the User class.
Warning
Non-public API. It may change with no previous notice
-
filter
(**search_args)¶ Should get all the current users from CARTO, but this is currently not supported by the API
-
get_collection_endpoint
()¶
-
get_resource_endpoint
(resource_id)¶
-
paginator_class
¶ alias of
CartoPaginator
-
carto.visualizations module¶
Module for working with map visualizations
-
class
carto.visualizations.
Visualization
(auth_client, **kwargs)¶ Bases:
carto.resources.WarnResource
Represents a map visualization in CARTO.
Warning
Non-public API. It may change with no previous notice
-
class
Meta
¶ -
collection_endpoint
= 'api/v1/viz/'¶
-
id_field
= 'id'¶
-
json_data
= True¶
-
name_field
= 'name'¶
-
parse_json
= True¶
-
-
Visualization.
active_child
= None¶
-
Visualization.
active_layer_id
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
attributions
= None¶
-
Visualization.
children
= None¶
-
Visualization.
created_at
¶ Field to store datetimes in resources
-
Visualization.
description
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
display_name
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
export
()¶ Make the actual request to the Import API (exporting is part of the Import API) to export a map visualization as a .carto file
Returns: A URL pointing to the .carto file Return type: str Raise: CartoException Warning
Non-public API. It may change with no previous notice
Note
The export is asynchronous, but this method waits for the export to complete. See MAX_NUMBER_OF_RETRIES and INTERVAL_BETWEEN_RETRIES_S
-
Visualization.
external_source
= None¶
-
Visualization.
fields
= ['liked', 'likes', 'active_layer_id', 'table', 'id', 'display_name', 'map_id', 'description', 'updated_at', 'locked', 'name', 'url', 'created_at', 'related_tables', 'title']¶
-
Visualization.
id
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
kind
= None¶
-
Visualization.
license
= None¶
-
Visualization.
liked
¶ Convenient class to make explicit that an attribute will store booleans
-
Visualization.
likes
¶ Convenient class to make explicit that an attribute will store integers
-
Visualization.
locked
¶ Convenient class to make explicit that an attribute will store booleans
-
Visualization.
map_id
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
name
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
next_id
= None¶
-
Visualization.
parent_id
= None¶
-
Visualization.
permission
= None¶
-
Visualization.
prev_id
= None¶
-
Visualization.
privacy
= None¶
-
Visualization.
source
= None¶
-
Visualization.
stats
= None¶
-
Visualization.
synchronization
= None¶
-
Visualization.
table
¶
-
Visualization.
title
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
transition_options
= None¶
-
Visualization.
type
= None¶
-
Visualization.
updated_at
¶ Field to store datetimes in resources
-
Visualization.
url
¶ Convenient class to make explicit that an attribute will store chars
-
Visualization.
uses_builder_features
= None¶
-
class
-
class
carto.visualizations.
VisualizationManager
(auth_client)¶ Bases:
carto.resources.Manager
Manager for the Visualization class.
Warning
Non-public API. It may change with no previous notice
-
create
(**kwargs)¶ Creating visualizations is better done by using the Maps API (named maps) or directly from your front end app if dealing with public datasets
-
json_collection_attribute
= 'visualizations'¶
-
paginator_class
¶ alias of
CartoPaginator
-
resource_class
¶ alias of
Visualization
-
send
(url, http_method, **client_args)¶ Sends API request, taking into account that visualizations are only a subset of the resources available at the visualization endpoint
Parameters: - url (str) – Endpoint URL
- http_method (str) – The method used to make the request to the API
- client_args (kwargs) – Arguments to be sent to the auth client
Returns: Raise: CartoException
-