Skip to main content

GeoLibs CARTOasync

Project description


Asynchronous Python client for CARTO.


  • <input type="checkbox" checked="" disabled="" /> SQL API
  • <input type="checkbox" disabled="" /> Batch API
  • <input type="checkbox" disabled="" /> COPY queries
  • <input type="checkbox" disabled="" /> Import API
  • <input type="checkbox" disabled="" /> Read and write Panda's DataFrames
  • <input type="checkbox" disabled="" /> Maps API?
  • <input type="checkbox" disabled="" /> 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;')

>>> {
>>>   "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 = Auth(username='username', api_key='api_key')
1.2. CARTO OnPremises or cloud organization with an implict user:
auth = Auth(base_url='', api_key='api_key')
1.3. CARTO OnPremises or cloud organization without an implicit user:
auth = 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:
2.1. SQLClient's own AIOHTTP session:
sql_client = SQLClient(auth)
result = await sql_client.send('SELECT 1 AS one;')
2.2. External AIOHTTP session you need to care until the end of its days:
import aiohttp

sql_client = SQLClient(auth)
result = await sql_client.send('SELECT 1 AS one;', aiohttp.ClientSession())

Project details

Download files

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

Files for geolibs-cartoasync, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size geolibs_cartoasync-0.0.4-py3-none-any.whl (4.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size geolibs-cartoasync-0.0.4.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

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