If you try to import a dataset with a non-organization user, it imports the dataset correctly, but then it raises an error:
from carto.auth import APIKeyAuthClient
from carto.datasets import DatasetManager
auth_client = APIKeyAuthClient(api_key="APIKEY", base_url="https://NONORGUSER.carto.com/")
dataset_manager = DatasetManager(auth_client)
dataset = dataset_manager.create(DATAURL)
This is the error (I've omitted non-relevant information).
.../carto-python/carto/resources.py:90: FutureWarning: This is part of a non-public CARTO API and may change in the future. Take this into account if you are using this in a production environment
warnings.warn('This is part of a non-public CARTO API and may change in the future. Take this into account if you are using this in a production environment', FutureWarning)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../carto-python/carto/datasets.py", line 213, in create
table = TableManager(self.client).get(import_job.table_id)
...
File ".../carto-python/carto/users.py", line 64, in __init__
organization-enabled APIKeyAuthClient"))
carto.exceptions.CartoException: User management requires an organization-enabled APIKeyAuthClient
The problem seems to be that, after the import, the table information is requested (with Table class) which contains a permission (PermissionFieldclass) which in turn has an owner ( Userclass), But the User class only support organization users.
I've managed to avoid the problem with this patch:
If you try to import a dataset with a non-organization user, it imports the dataset correctly, but then it raises an error:
This is the error (I've omitted non-relevant information).
The problem seems to be that, after the import, the table information is requested (with
Table
class) which contains apermission
(PermissionField
class) which in turn has an owner (User
class), But the User class only support organization users.I've managed to avoid the problem with this patch: