importccl: add EXPORT option to write schema to file
IMPORT supports reading its CREATE TABLE statement from a file, so adding an option to EXPORT that writes a compatible CREATE TABLE to a file would make round-tripping easier.
NB: to be round-trip compatible with IMPORT, such a CREATE TABLE cannot contain FK constraints. Additionally,EXPORT can dump arbitrary query results, not just individual tables, so it isn't obvious that the dumped schema is a SHOW CREATE TABLE of some existing table at all, but rather maybe just synthesized from the column types (similar to the logic in CREATE AS or view creation)
@dt can I pick this issue up?
IMPORTsupports reading itsCREATE TABLEstatement from a file, so adding an option toEXPORTthat writes a compatibleCREATE TABLEto a file would make round-tripping easier.NB: to be round-trip compatible with
IMPORT, such aCREATE TABLEcannot contain FK constraints. Additionally,EXPORTcan dump arbitrary query results, not just individual tables, so it isn't obvious that the dumped schema is aSHOW CREATE TABLEof some existing table at all, but rather maybe just synthesized from the column types (similar to the logic inCREATE ASor view creation)
@dt shall I take it if no one is working on it
~Still desirable, will keep it in the backlog.~
We are deprecating this pattern in general. IMPORT is moving to decouple from schemas, and one can just SHOW CREATE TABLE, doesn’t need to be part of EXPORT.
We’re unlikely to prioritize this, so closing. Happy to discuss if people disagree.