CartoDB / carto-python

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

v1.0.0 : VisualizationManager does not return tables of the map #32

Closed oriolbx closed 7 years ago

oriolbx commented 7 years ago

When using the class VisualizationManager, the object table does not return the tables of the map but the client object.

I'm using the next code to get the table object values:

auth_client = APIKeyAuthClient(CARTO_BASE_URL, CARTO_API_KEY, organization)

visualization_manager = VisualizationManager(auth_client)

mapa = visualization_manager.get("mapName")
printer.pprint(mapa.__dict__)

printer.pprint(mapa.table.__dict__)

The result of python is:

{   'active_layer_id': None,
    'client': <carto.auth.APIKeyAuthClient object at 0x10f509950>,
    'created_at': u'2016-12-03T23:45:11+00:00',
    'description': None,
    'display_name': None,
    'id': u'87e6f95c-b9b2-11e6-8d20-0e3ebc282e83',
    'liked': False,
    'likes': 0,
    'locked': False,
    'map_id': u'7ed57ea1-2958-4577-bcfa-446572a1e7d2',
    'name': u'Stores',
    'table': <carto.tables.Table object at 0x10f517f50>,
    'title': None,
    'updated_at': u'2016-12-05T18:55:58+00:00',
    'url': u'https://cartoworkshops.carto.com/u/carto-workshops/viz/87e6f95c-b9b2-11e6-8d20-0e3ebc282e83/map'}
{   'client': <carto.auth.APIKeyAuthClient object at 0x10f509950>}
alrocar commented 7 years ago

Tested the viz API, and the table object is always empty, that's why in your case the __dict__ attribute was empty.

I've added to the Visualization class the related_tables field, which is an array of the tables contained in the map. I guess that was the attribute you were looking for.