vaticle / typedb-console

TypeDB Console: CLI for TypeDB and TypeDB Cluster
https://typedb.com
Mozilla Public License 2.0
7 stars 16 forks source link

Export schema in a file without unnecessary lines #199

Open izmalk opened 1 year ago

izmalk commented 1 year ago

Problem to Solve

We have an export feature that includes database schema {db-name} command.

But the output of the command is straight to the console.

While for export we would like to have a file output. Especially if we have a long schema that can't fit the console.

We can go with the following:

typedb console --command="database schema db-name" > ~/schema.tql

But it provides not only the result but also some addons — at least the first line contains + database schema db-name text. So the resulting file can't be used for import without additional (trivial) editing.

That is very inconvenient for the automation of these tasks with export (backup).

Current Workaround

  1. Export the file.
  2. Delete the first line.
  3. Import the file.

Proposed Solution

Make it possible to export the file ready to be imported. With the same or different (e.g. "export") single command.

Additional Information

schema_cti.tql.zip

izmalk commented 1 year ago

Alternatively, we can modify the data export feature of typedb to include schema in tql format (probably as a separate file).