Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DROP TABLE not synchronizing with user_tables #401

Open
Rikaelus opened this issue Jan 6, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@Rikaelus
Copy link

commented Jan 6, 2017

Coming here after a lack of responses on StackExchange

Summary:
While creating an environment test script we've discovered that dropping a table via the SQL API seems to leave a reference to that table alive in carto_db_production.user_tables. Documentation here seems to suggest a delayed, periodic check might be responsible for cleaning up loose ends when certain table changes are made via query, but this doesn't seem to be the case. The entry remains for days, at least, and I think is responsible for the dataset being listed in the UI, though the actual table missing obviously prevents full viewing of the dataset.

Side note: We're initially creating the dataset via the Imports API.

@mondeja

This comment has been minimized.

Copy link

commented Oct 4, 2018

I have encountered the same problem. I've solved connecting with the machine that is running Carto through SSH and executing queries directly with the PostgreSQL database. First I'm executing a query thorugh SQL API:

DROP TABLE IF EXISTS <dataset_name> CASCADE;COMMIT;

And next, I'm executing two queries though SSH:

psql -U postgres -d carto_db_development -c "DELETE FROM user_tables WHERE (name='<dataset_name>' AND user_id='<carto_user_id>');"
psql -U postgres -d carto_db_development -c "DELETE FROM visualizations WHERE (name='<dataset_name>' AND user_id='<carto_user_id>');"

You can get the carto_user_id executing thorugh SQL API SELECT current_database(); and getting the HEX string separated by - characters.

I'm not sure if is the correct way to do this or if there are more metadata that needs to be deleted in order to avoid other conflicts, but it works, datasets are deleted from Carto Builder datasets administration interface. I hope this can help someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.