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

Dolt Schema Export/Import can't be used together? #431

Closed
coffeegoddd opened this issue Feb 26, 2020 · 1 comment
Closed

Dolt Schema Export/Import can't be used together? #431

coffeegoddd opened this issue Feb 26, 2020 · 1 comment
Assignees

Comments

@coffeegoddd
Copy link
Contributor

coffeegoddd commented Feb 26, 2020

USER STORY:
A user wants to export a table schema from one repository and use it as the schema for a different repository.

User displays the schema from repo1:
$ dolt schema show
which outputs:

test_table @ working
CREATE TABLE `test_table` (
  `name` VARCHAR(255) NOT NULL COMMENT 'tag:0',
  `age` INT NOT NULL COMMENT 'tag:1',
  PRIMARY KEY (`name`)
);

User wants to export this schema to repo2's dir in a file test_table_schema:
$ dolt schema export test_table ../repo2/test_table_schema

User cds to ../repo2 and cats test_table_schema (with the expectation to see sql, since dolt schema show displayed sql?) but sees json:

{
  "columns": [
    {
      "tag": 0,
      "name": "name",
      "is_part_of_pk": true,
      "typeinfo": {
        "type": "varstring",
        "params": {
          "collate": "utf8mb4_0900_ai_ci",
          "length": "255",
          "sql": "varchar"
        }
      },
      "col_constraints": [
        {
          "constraint_type": "not_null",
          "params": null
        }
      ]
    },
    {
      "tag": 1,
      "name": "age",
      "is_part_of_pk": false,
      "typeinfo": {
        "type": "int",
        "params": {
          "width": "32"
        }
      },
      "col_constraints": [
        {
          "constraint_type": "not_null",
          "params": null
        }
      ]
    }
  ]
}

User attempts to import this schema for test_table in repo2:
$ dolt schema import --create --pks=name test_table test_table_schema

which outputs:
panic: runtime error: index out of range [0] with length 0

BUG: dolt schema import failed to infer schema

User attempts to import this schema specifying the file type:
$ dolt schema import --create --pks=name test_table --file-type=json test_table_schema

which outputs:
error: unsupported file type 'json'

BUG: dolt schema import is unable to import the only format exported by dolt schema export

I also think it's a little clunky to have to manually define primary keys when the file created from dolt schema export defines all of the primary keys already

@coffeegoddd coffeegoddd changed the title New Dolt Export/Import require different formats? Feb 26, 2020
@coffeegoddd coffeegoddd changed the title Dolt Export/Import require different formats? Dolt Schema Export/Import require different formats? Feb 26, 2020
@coffeegoddd coffeegoddd changed the title Dolt Schema Export/Import require different formats? Dolt Schema Export/Import can't be used together? Feb 26, 2020
@andy-wm-arthur andy-wm-arthur self-assigned this Apr 28, 2020
@VinaiRachakonda
Copy link
Contributor

Just tested and this error still exists

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

No branches or pull requests

3 participants