carto-python icon indicating copy to clipboard operation
carto-python copied to clipboard

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

Open oriolbx opened this issue 6 years ago • 1 comments

Contect

  • Python SDK version: 1.6.0

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

oriolbx avatar Aug 08 '19 08:08 oriolbx

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

Thanks for reporting!

alrocar avatar Aug 28 '19 14:08 alrocar