To truncate all tables in DuckDB, you can use the TRUNCATE statement, which removes all rows from a table. However, DuckDB does not support truncating views directly. You would need to drop and recreate views if you want to refresh them. Here's a general approach: 1. Truncate Tables: Use the TRUNCATE statement for each table.
2. Drop and Recreate Views: Use DROP VIEW followed by CREATE VIEW for each view.Would you like more detailed guidance on executing these steps?Sources:
- https://motherduckcommunity.slack.com/archives/C058PJL4R0S/p1711382836.342819
- https://duckdb.org/docs/preview/sql/statements/delete
💡Hint: Mention RunLLM in the thread for followups.
One option is to use the COPY FROM DATABASE (SCHEMA) command
COPY FROM DATABASE db1 TO db2 (SCHEMA);
which will copy only the schema and not the data. (not sure if this works in place or not, or whether you’d need to copy to a dummy database first)