CartoDB / cartoframes

CARTO Python package for data scientists
BSD 3-Clause "New" or "Revised" License
249 stars 63 forks source link

Deleting tables and dependent visualizations #357

Open andy-esch opened 6 years ago

andy-esch commented 6 years ago

cc.delete does not discriminate whether a dataset is involved in a visualization or not. We should add a trigger that causes cc.delete to throw an error if the dataset is claimed. And we should add an additional option to force=True|False it to force the operation regardless.

Some of this information is available in the private api/v1/table endpoint, but I'm unsure if this endpoint should be used outside of builder/editor.

alrocar commented 5 years ago

Related issue: https://github.com/CartoDB/carto-python/pull/107

simon-contreras-deel commented 5 years ago

Coming from https://github.com/CartoDB/cartoframes/pull/589 as @alrocar said, the implementation would be something like:

carto_dataset = DatasetManager(auth_client).get(table_name)

But If the dataset exists, try to delete it

carto_dataset.delete()

As per this PR it will raise an exception if it has dependent visualizations.

alrocar commented 5 years ago

Just merged this PR from a @jesusbotella leapfrog 🎉 🎉 🎉

In Python SDK:

We just could include that logic in the cc.delete(force=True|False) method

Jesus89 commented 4 years ago

https://app.clubhouse.io/cartoteam/story/70790/delete-tables-depending-on-whether-they-have-an-api-key