CartoDB / carto-python

CARTO Python client
https://carto.com
BSD 3-Clause "New" or "Revised" License
154 stars 62 forks source link

Should SQLClient return more accurate types? #84

Closed juanignaciosl closed 5 years ago

juanignaciosl commented 6 years ago
>>> execfile('cartoframes/context.py')
>>> execfile('cartoframes/examples.py')
>>> base_url = EXAMPLE_BASE_URL
>>> api_key = EXAMPLE_API_KEY
>>> session = None
>>> creds = None
>>> creds = Credentials(creds=creds, key=api_key, base_url=base_url)
>>> auth_client = APIKeyAuthClient(base_url=creds.base_url(),api_key=creds.key(),session=session)
>>> sql_client = SQLClient(auth_client)
>>> res = sql_client.send("select current_schemas('f')", **DEFAULT_SQL_ARGS)
>>> res['rows'][0]['current_schemas']
u'{public,cartodb}'
>>> type(res['rows'][0]['current_schemas'])
<type 'unicode'>

Wouldn't it be nice if running a query returned the proper type? In this example, it should be a string array instead of a string. Is this feasible?

cc @danicarrion

simon-contreras-deel commented 5 years ago

It is already solved in https://github.com/CartoDB/CartoDB-SQL-API/issues/498