cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

importccl: add EXPORT option to write schema to file

Open dt opened this issue 8 years ago • 3 comments

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 avatar May 01 '18 13:05 dt

@dt can I pick this issue up?

devdil avatar Jan 24 '20 10:01 devdil

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 shall I take it if no one is working on it

asheikm avatar Apr 02 '21 21:04 asheikm

~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.

shermanCRL avatar Jun 22 '21 19:06 shermanCRL