Delete all columns in a database

I’m trying to delete all data in a data table, including columns and rows.

I have found the formula to delete all rows (app_tables.data.delete_all_rows()) and it works correctly. But I am trying to delete also all columns and it doesn’t work.

How do I delete all columns?

Thank you in advance.

You can’t do that, but you could upvote this feature request for it:

Yes, I will do it.

Actually, is there any way to delete columns from a database with python?

There are ways that Python can operate a browser, to automate manual steps (e.g., in the IDE), but I haven’t tried it. Seems like it would be complex, ugly, and fragile.

With a high-level subscription plan, you can get SQL access to the underlying database.

1 Like

I do have a dedicated plan with SQL access, but I’m not going to modify any schema that was automatically created with the Anvil UI. I don’t want to risk to delete a column from one view and then the whole table stops working because I did the wrong thing with other support tables that keep track of whatever needs to be track kept.

I will wait for the FR to be addressed.

2 Likes

I will wait for a new function, like this app_tables.data.delete_all_rows(), to delete columns.

Thanks to all for the help.

1 Like