Skip to content
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

import: Import multiple tables at once #92

Closed
craigds opened this issue May 27, 2020 · 1 comment · Fixed by #118
Closed

import: Import multiple tables at once #92

craigds opened this issue May 27, 2020 · 1 comment · Fixed by #118
Assignees
Milestone

Comments

@craigds
Copy link
Member

craigds commented May 27, 2020

sno init --import and sno import handle only one table at a time. To import a whole database you have to run sno import multiple times. We can improve this.

Background

#83 changed the import command semantics a little, adding the --table={table} flag.

While we could just make that flag usable multiple times (--table=table1 --table=table2) it feels clunky, makes it hard to apply arguments with tools like xargs, etc.

A better pattern would be sno import {source} table1 [table2...].

However we also have some existing positional arguments, which would make this approach ambiguous:

  • in sno import, an existing positional argument (confusingly named DIRECTORY in the usage text) which is the imported name of the table. This allows the user to rename tables as they import.
  • in sno init, a separate thing also called DIRECTORY, which is the directory where the repo should be initialised. This is the same as the git init argument of the same name.

Proposal

  1. change --table=TABLE and turn it into a positional argument with multiple values allowed.
  2. To allow for renaming tables during import, use something like tablename:newtablename or tablename@newtablename. This removes the need for the DIRECTORY argument to sno import, so we can remove that.
  3. Import all tables from a source with an --all-tables flag. If --all-tables is given, don't support renaming.
  4. Turn the DIRECTORY arg of sno init into a --path DIRECTORY option.
@craigds craigds added this to the 0.4 milestone May 27, 2020
@craigds craigds self-assigned this May 27, 2020
@craigds
Copy link
Member Author

craigds commented Jun 4, 2020

I've made a WIP branch for this at https://github.com/koordinates/sno/tree/multi-table-import

craigds added a commit that referenced this issue Jun 15, 2020
@craigds craigds mentioned this issue Jun 15, 2020
1 task
craigds added a commit that referenced this issue Jun 15, 2020
craigds added a commit that referenced this issue Jun 15, 2020
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 a pull request may close this issue.

1 participant