mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 04:44:26 +02:00
Docs for compound primary keys with CLI
This commit is contained in:
parent
f47b5a9e19
commit
be9ff64940
2 changed files with 3 additions and 1 deletions
|
|
@ -200,6 +200,8 @@ Here's the simplest possible example::
|
||||||
|
|
||||||
To specify a column as the primary key, use ``--pk=column_name``.
|
To specify a column as the primary key, use ``--pk=column_name``.
|
||||||
|
|
||||||
|
To create a compound primary key across more than one column, use ``--pk`` multiple times.
|
||||||
|
|
||||||
If you feed it a JSON list it will insert multiple records. For example, if ``dogs.json`` looks like this::
|
If you feed it a JSON list it will insert multiple records. For example, if ``dogs.json`` looks like this::
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ def insert_upsert_options(fn):
|
||||||
),
|
),
|
||||||
click.argument("table"),
|
click.argument("table"),
|
||||||
click.argument("json_file", type=click.File(), required=True),
|
click.argument("json_file", type=click.File(), required=True),
|
||||||
click.option("--pk", help="Column to use as the primary key, e.g. id", multiple=True),
|
click.option("--pk", help="Columns to use as the primary key, e.g. id", multiple=True),
|
||||||
click.option("--nl", is_flag=True, help="Expect newline-delimited JSON"),
|
click.option("--nl", is_flag=True, help="Expect newline-delimited JSON"),
|
||||||
click.option("-c", "--csv", is_flag=True, help="Expect CSV"),
|
click.option("-c", "--csv", is_flag=True, help="Expect CSV"),
|
||||||
click.option(
|
click.option(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue