Docs for compound primary keys with CLI

This commit is contained in:
Simon Willison 2019-07-14 21:00:12 -07:00
commit be9ff64940
2 changed files with 3 additions and 1 deletions

View file

@ -200,6 +200,8 @@ Here's the simplest possible example::
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::
[

View file

@ -302,7 +302,7 @@ def insert_upsert_options(fn):
),
click.argument("table"),
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("-c", "--csv", is_flag=True, help="Expect CSV"),
click.option(