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

create-table command does not handle compound primary keys #620

Closed
simonw opened this issue Mar 17, 2024 · 2 comments
Closed

create-table command does not handle compound primary keys #620

simonw opened this issue Mar 17, 2024 · 2 comments
Labels
bug Something isn't working cli-tool

Comments

@simonw
Copy link
Owner

simonw commented Mar 17, 2024

I tried running this:

sqlite-utils create-table compound.db compound \
  category text id integer value text --pk category --pk id

And got this schema:

CREATE TABLE [compound] (
   [category] TEXT,
   [id] INTEGER PRIMARY KEY,
   [value] TEXT
);
@simonw simonw added bug Something isn't working cli-tool labels Mar 17, 2024
@simonw
Copy link
Owner Author

simonw commented Mar 17, 2024

The documentation doesn't indicate that this works, but it should work for consistency with how transform works.

https://sqlite-utils.datasette.io/en/stable/cli.html#cli-create-table

@simonw
Copy link
Owner Author

simonw commented Mar 17, 2024

Looking at https://sqlite-utils.datasette.io/en/latest/cli-reference.html there are other commands that should accept multiple primary keys as well:

  • insert
  • upsert
  • insert-files

The transform command accepts multiple --pk already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli-tool
Projects
None yet
Development

No branches or pull requests

1 participant