mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
parent
328211eaca
commit
2f3371ecb1
2 changed files with 25 additions and 3 deletions
|
|
@ -732,9 +732,16 @@ def insert_upsert_implementation(
|
|||
extra_kwargs["upsert"] = upsert
|
||||
# Apply {"$base64": true, ...} decoding, if needed
|
||||
docs = (decode_base64_values(doc) for doc in docs)
|
||||
db[table].insert_all(
|
||||
docs, pk=pk, batch_size=batch_size, alter=alter, **extra_kwargs
|
||||
)
|
||||
try:
|
||||
db[table].insert_all(
|
||||
docs, pk=pk, batch_size=batch_size, alter=alter, **extra_kwargs
|
||||
)
|
||||
except sqlite3.OperationalError as e:
|
||||
if e.args and "has no column named" in e.args[0]:
|
||||
raise click.ClickException(
|
||||
"{}\n\nTry using --alter to add additional columns".format(e.args[0])
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue