Skip to content

Document tt export/import #3737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2023
Merged

Document tt export/import #3737

merged 1 commit into from
Oct 3, 2023

Conversation

andreyaksenov
Copy link
Contributor

@andreyaksenov andreyaksenov commented Sep 26, 2023

This was linked to issues Sep 26, 2023
@andreyaksenov andreyaksenov force-pushed the tt-export-import branch 23 times, most recently from 5234413 to 2765071 Compare October 2, 2023 10:49
@andreyaksenov andreyaksenov requested a review from psergee October 2, 2023 10:49
@andreyaksenov andreyaksenov force-pushed the tt-export-import branch 3 times, most recently from a012399 to f1dc23e Compare October 2, 2023 11:41
@andreyaksenov andreyaksenov requested a review from p7nov October 2, 2023 18:41
@andreyaksenov andreyaksenov force-pushed the tt-export-import branch 3 times, most recently from 18d1567 to 395ad98 Compare October 3, 2023 10:08
Copy link
Contributor

@p7nov p7nov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some edits and questions from my side.
Some comments from export are applicable to import as well; I didn't duplicate them.


$ tt crud COMMAND [COMMAND_OPTION ...]

``tt crud`` enables you to interact with a cluster using the `CRUD <https://github.com/tarantool/crud>`_ module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-personal wording looks better in references.

Suggested change
``tt crud`` enables you to interact with a cluster using the `CRUD <https://github.com/tarantool/crud>`_ module.
``tt crud`` enables the interaction with a cluster using the `CRUD <https://github.com/tarantool/crud>`_ module.


$ tt [crud] export URI FILE SPACE [EXPORT_OPTION ...]

``tt [crud] export`` exports a space's data to a file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if possessive is correct for this case (space's data).
Maybe rephrase?

Suggested change
``tt [crud] export`` exports a space's data to a file.
``tt [crud] export`` exports data from a given space to a file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, maybe mention the file format in this general description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a space's data

I believe, possessive works good for our space term.

Also, maybe mention the file format in this general description?

Currently, only CSV is supported but other formats may be added in the future. And given that CSV is the only supported format, for example, CSV will look a bit weird, too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be precise, I would write "to a CSV file". If other format appear later, we'll update the description.


.. NOTE::

You should have :ref:`read access <authentication-owners_privileges>` to the required space to be able to export data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear who is you in this sentence. The reader runs tt outside of Tarantool.
Shorter wording: to the required space to be able to export data. > to the space to export its data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update to Read access to the space is required to export its data.


.. NOTE::

Exporting isn't supported for the :ref:`interval <index-box_interval>` field type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly does it mean? Export does not work on spaces with such field? Export works but interval fields are lost? Anything else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've checked: exporting works, data of this field is exported but looks unreadable and causes an error on an attempt to import it back.

Exporting compound data
-----------------------

By default, ``tt`` exports empty values for fields containing compound data like arrays or maps.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, ``tt`` exports empty values for fields containing compound data like arrays or maps.
By default, ``tt`` exports empty values for fields containing compound data such as arrays or maps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like - similar object, such as - actual examples.

Automatic matching
~~~~~~~~~~~~~~~~~~

Suppose, you have the ``customers.csv`` file with a header containing field names in the first row:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Suppose, you have the ``customers.csv`` file with a header containing field names in the first row:
Suppose that you have the ``customers.csv`` file with a header containing field names in the first row:

Manual matching
~~~~~~~~~~~~~~~

The ``--match`` option enables you to import data by matching field names in the input file and the target space manually.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ``--match`` option enables you to import data by matching field names in the input file and the target space manually.
The ``--match`` option enables importing data by matching field names in the input file and the target space manually.

Handling parsing errors
-----------------------

To skip rows whose data cannot be parsed correctly, you can use the ``--on-error`` option as follows:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To skip rows whose data cannot be parsed correctly, you can use the ``--on-error`` option as follows:
To skip rows whose data cannot be parsed correctly, use the ``--on-error`` option as follows:

.. option:: -success STRING

The name of a file with rows that were imported (the default is ``success``).
Overrides the file if it already exists.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't understand what exactly this means. Overwrites?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly

@@ -5,6 +5,11 @@ To install the ``tt`` command-line utility, use a package manager -- Yum or
APT on Linux, or Homebrew on macOS. If you need a specific build, you can build
``tt`` from sources.

.. NOTE::

A Tarantool Enterprise's `release package <https://www.tarantool.io/en/enterprise_doc/setup/#package-contents>`_ includes the `tt` utility extended with additional features like :ref:`importing <tt-crud-import>` and :ref:`exporting <tt-crud-export>` data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put this (or similar) text on the main tt CLI page to explain the existence/positioning of tt EE in general?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add it to the intro

@andreyaksenov andreyaksenov force-pushed the tt-export-import branch 2 times, most recently from 29d0ae4 to 07d6e32 Compare October 3, 2023 11:49
@andreyaksenov andreyaksenov requested a review from p7nov October 3, 2023 11:50
Copy link
Contributor

@p7nov p7nov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple more notes.


$ tt [crud] export URI FILE SPACE [EXPORT_OPTION ...]

``tt [crud] export`` exports a space's data to a file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be precise, I would write "to a CSV file". If other format appear later, we'll update the description.


:ref:`Read access <authentication-owners_privileges>` to the space is required to export its data.

.. NOTE::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to write in the first review: this should be important or even warning because the data loss is possible.

``tt`` is a utility that provides a unified command-line interface for managing
Tarantool-based applications. It covers a wide range of tasks -- from installing
a specific Tarantool version to managing remote instances and developing applications.

``tt`` is developed in its own `GitHub repository <https://github.com/tarantool/tt>`_.
Here you can find its source code, changelog, and releases information.
There is also the Enterprise version of ``tt`` is available in a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add a blank line to separate the new paragraph.

@andreyaksenov andreyaksenov merged commit 5c9b5e2 into latest Oct 3, 2023
@andreyaksenov andreyaksenov deleted the tt-export-import branch October 3, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tt (crud) export TT (crud) import
3 participants