CartoDB / carto-python

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

Import .carto file with create_vis parameter doesn't create a map #144

Open oriolbx opened 5 years ago

oriolbx commented 5 years ago

Contect

According to the CARTO Import API documentation, in order to import a .carto file into CARTO, you have to add the parameter "create_vis=true".

When I try to import a carto file using the Python SDK using the parameter create_vis=True, CARTO is importing only the datasets but it is not creating the map:

dataset_manager = DatasetManager(auth_client)
for filename in glob.iglob('output/*.carto'):    
    # files = {'file': open(Path(filename), 'rb')}
    table = dataset_manager.create(filename, interval=None, create_vis=True)

However, if I call the CARTO Import API directly like this, the carto file is importing the datasets and it creates the map:

 r = requests.post('https://{username}.carto.com/api/v1/imports/?api_key={api}&create_vis=true'.format(username=new_username, api=api_key_new_username), files=files)

If I other parameters to set the different properties of the created dataset, for example to set the privacy of the dataset that is imported, CARTO creates the dataset properly:

dataset_manager = DatasetManager(auth_client)
for filename in glob.iglob('output/*.carto'):    
    # files = {'file': open(Path(filename), 'rb')}
    table = dataset_manager.create(filename, interval=None, privacy='link')

Is create_vis in the Python SDK the correct name of the parameter to create a map from a .carto file?

cc @oleurud

alrocar commented 5 years ago

Removing from RT since seems minor (and there's a workaround).

Thanks for reporting!