Closed mheydel closed 9 months ago
@windiana42 @nicolasmueller
@MichalHeydelQC are you trying to use the DDL commands directly, or are you experiencing a failure of pipedag? In case of the latter please describe a bit more about the failure. I agree with you that drop-cascade implementation with this functionality would be nice. But pipedag probably initializes a schema by dropping database specific things before it attempts to execute drop schema.
To drop a schema cascade in IBM DB2, one must first drop all the nicknames. That is not yet implemented.
I think somewhere here, one should adjust that. https://github.com/pydiverse/pydiverse.pipedag/blob/a20dc1f1de8a9070e027c7ece9c3ef4bc12869c1/src/pydiverse/pipedag/backend/table/sql/ddl.py#L569-L574C56
To get the current nicknames in a schema in IBM, one can query:
SELECT TABNAME FROM SYSCAT.TABLES WHERE TABSCHEMA='<schema>' and TYPE="N"
Drop nickname SQL command is as simple as:
DROP NICKNAME <schema>.<tbl_name>