We're running our own CartoDB stack and all is working well, but in writing an API testing script, that creates and subsequently deletes a dataset, we've discovered we're not sure how to programmatically delete a dataset completely.
Existing questions I've found on the net about this all lead to using the SQL API to simply DROP the dataset's table, but that leaves references to that table in place in the primary Carto database, and that means the dataset is still listed in the UI but errors out when trying to view it -- basically the Carto UI application still thinks the dataset exists, even without its table.
That primary database is also outside the range of the SQL API so a DELETE query isn't plausible.
Has anyone found a more "correct" way of doing this? It seems like an incredibly huge gaping hole in API functionality not to be able to delete something you've created.
Addendum: I see that the SQL API has the "cdb_cartodbfytable" function that registers a table (created with the SQL API) so that it's visible to the editor, but doesn't seem to have an equivalent function to deregister upon dropping.
Edit: After a few days of no response I've also added it as an issue in the software's repo. https://github.com/CartoDB/CartoDB-SQL-API/issues/401