GeoLibs CARTOasync
Project description
GeoLibs-CARTOasync
Asynchronous Python client for CARTO.
Features
- SQL API
- Batch API
- COPY queries
- Import API
- Read and write Panda's DataFrames
- Maps API?
- Tests
Installation
pip install cartoasync
Usage
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()
print(result)
>>> {
>>> "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='https://myapp.com/user/username/', api_key='api_key')
1.3. CARTO OnPremises or cloud organization without an implicit user:
Auth(base_url='https://myapp.com/', 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
Built Distribution
Close
Hashes for geolibs_cartoasync-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de138bda52d2a180384eb2e426861dae8373791e7ebd25df4c0a6049c608004c |
|
MD5 | cf549819997c9c6dc8bb7ac617693acd |
|
BLAKE2b-256 | 49747ee673f839889765a00d234a0abd9c30ff4aeb2873112d2bebf4e4cade3d |