mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 12:54:15 +02:00
Fix remaining type errors in cli.py
- Add typing import and type annotations for dict kwargs - Use db.table() instead of db[] for extract command - Fix missing str() conversion for exception 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
29842be858
commit
5c15db90f4
1 changed files with 5 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import base64
|
import base64
|
||||||
|
from typing import Any
|
||||||
import click
|
import click
|
||||||
from click_default_group import DefaultGroup # type: ignore
|
from click_default_group import DefaultGroup # type: ignore
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
@ -705,7 +706,7 @@ def enable_fts(
|
||||||
replace=replace,
|
replace=replace,
|
||||||
)
|
)
|
||||||
except OperationalError as ex:
|
except OperationalError as ex:
|
||||||
raise click.ClickException(ex)
|
raise click.ClickException(str(ex))
|
||||||
|
|
||||||
|
|
||||||
@cli.command(name="populate-fts")
|
@cli.command(name="populate-fts")
|
||||||
|
|
@ -1042,7 +1043,7 @@ def insert_upsert_implementation(
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
dialect = "excel-tab" if tsv else "excel"
|
dialect = "excel-tab" if tsv else "excel"
|
||||||
csv_reader_args = {"dialect": dialect}
|
csv_reader_args: dict[str, Any] = {"dialect": dialect}
|
||||||
if delimiter:
|
if delimiter:
|
||||||
csv_reader_args["delimiter"] = delimiter
|
csv_reader_args["delimiter"] = delimiter
|
||||||
if quotechar:
|
if quotechar:
|
||||||
|
|
@ -2656,13 +2657,13 @@ def extract(
|
||||||
db = sqlite_utils.Database(path)
|
db = sqlite_utils.Database(path)
|
||||||
_register_db_for_cleanup(db)
|
_register_db_for_cleanup(db)
|
||||||
_load_extensions(db, load_extension)
|
_load_extensions(db, load_extension)
|
||||||
kwargs = dict(
|
kwargs: dict[str, Any] = dict(
|
||||||
columns=columns,
|
columns=columns,
|
||||||
table=other_table,
|
table=other_table,
|
||||||
fk_column=fk_column,
|
fk_column=fk_column,
|
||||||
rename=dict(rename),
|
rename=dict(rename),
|
||||||
)
|
)
|
||||||
db[table].extract(**kwargs)
|
db.table(table).extract(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@cli.command(name="insert-files")
|
@cli.command(name="insert-files")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue