Skip to main content

GeoLibs CARTOasync

Project description


Asynchronous Python client for CARTO.


  • Batch API
  • COPY queries
  • Import API
  • Read and write Panda's DataFrames
  • Maps API?
  • Tests


pip install cartoasync


SQL API example

from cartoasync import Auth, SQLClient

auth = Auth(username='username', api_key='api_key')
sql_client = SQLClient(auth)

result = await sql_client.send('SELECT 1 AS one;')
await sql_client.close()

>>> {
>>>   "rows": [
>>>     {
>>>       "one": 1
>>>     }
>>>   ],
>>>   "time": 0.002,
>>>   "fields": {
>>>     "one": {
>>>       "type": "number"
>>>     }
>>>   },
>>>   "total_rows": 1
>>> }

SQL API example, step by step

1. Instantiate an Auth object:
1.1. CARTO cloud:
Auth(username='username', api_key='api_key')
1.2. CARTO OnPremises or cloud organization with an implict user:
Auth(base_url='', api_key='api_key')
1.3. CARTO OnPremises or cloud organization without an implicit user:
Auth(base_url='', username='username', api_key='api_key')
1.4. SSL:

The Auth constructor has and ssl attribute. You can use it for handle to the library a Python's SSL context, or set it to False for relaxing certification checks. More info on AIOHTTP doc.

2. Instantiate the SQLClient and send queries. Optionally, close the client's connections pool:
sql_client = SQLClient(auth)
result = await sql_client.send('SELECT 1 AS one;')
3. Optionally, cose the client's connections pool:
await sql_client.close()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geolibs-cartoasync-0.0.2.tar.gz (3.8 kB view hashes)

Uploaded source

Built Distribution

geolibs_cartoasync-0.0.2-py3-none-any.whl (4.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page