Closed
Description
Is your idea related to a problem? Please describe.
When using awswrangler.redshift.to_sql
with mode='overwrite'
, the following code is executed:
The approach fails if you have any views on top of the table.
redshift_connector.error.ProgrammingError: {'S': 'ERROR', 'C': '2BP01', 'M': 'cannot drop table some_schema.some_table
because other objects depend on it', 'H': 'Use DROP ... CASCADE to drop the dependent objects too.', 'F': '/home/ec2-
user/padb/src/pg/src/backend/catalog/dependency_v2.c', 'L': '677', 'R': 'reportDependentObjects'}
Describe the solution you'd like
- overwrite mode should just truncate the table instead of dropping it
- additional parameter for
to_sql
method should be provided, e.g.overwrite_method = "drop" | "truncate" | "cascade"