mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-16 13:34:10 +02:00
Apply black formatting
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7af8SxFZqiCerJB6MqKnY
This commit is contained in:
parent
46db18e5ab
commit
f9554d36e4
2 changed files with 5 additions and 9 deletions
|
|
@ -4532,9 +4532,7 @@ class Table(Queryable):
|
||||||
else:
|
else:
|
||||||
first_record_dict = cast(Dict[str, Any], first_record)
|
first_record_dict = cast(Dict[str, Any], first_record)
|
||||||
if hash_id:
|
if hash_id:
|
||||||
self.last_pk = hash_record(
|
self.last_pk = hash_record(first_record_dict, hash_id_columns)
|
||||||
first_record_dict, hash_id_columns
|
|
||||||
)
|
|
||||||
elif isinstance(pk, str):
|
elif isinstance(pk, str):
|
||||||
self.last_pk = first_record_dict[
|
self.last_pk = first_record_dict[
|
||||||
resolve_casing(pk, first_record_dict)
|
resolve_casing(pk, first_record_dict)
|
||||||
|
|
@ -4587,9 +4585,7 @@ class Table(Queryable):
|
||||||
self.last_rowid = result.lastrowid
|
self.last_rowid = result.lastrowid
|
||||||
# A rowid-alias pk resolves directly to the rowid, so there
|
# A rowid-alias pk resolves directly to the rowid, so there
|
||||||
# is no separate pk column to look up
|
# is no separate pk column to look up
|
||||||
rowid_pk = (
|
rowid_pk = isinstance(pk, str) and pk.lower() in ROWID_ALIASES
|
||||||
isinstance(pk, str) and pk.lower() in ROWID_ALIASES
|
|
||||||
)
|
|
||||||
if (hash_id or (pk and not rowid_pk)) and self.last_rowid:
|
if (hash_id or (pk and not rowid_pk)) and self.last_rowid:
|
||||||
# Set self.last_pk to the pk(s) for that rowid
|
# Set self.last_pk to the pk(s) for that rowid
|
||||||
row = list(self.rows_where("rowid = ?", [self.last_rowid]))[0]
|
row = list(self.rows_where("rowid = ?", [self.last_rowid]))[0]
|
||||||
|
|
|
||||||
|
|
@ -998,9 +998,9 @@ def test_insert_ignore_reports_existing_row(fresh_db):
|
||||||
table = fresh_db["docs"].insert({"id": 1, "title": "One"}, ignore=True)
|
table = fresh_db["docs"].insert({"id": 1, "title": "One"}, ignore=True)
|
||||||
assert table.last_rowid == 1
|
assert table.last_rowid == 1
|
||||||
assert table.last_pk == 1
|
assert table.last_pk == 1
|
||||||
assert list(
|
assert list(fresh_db["docs"].rows_where("rowid = ?", [table.last_rowid])) == [
|
||||||
fresh_db["docs"].rows_where("rowid = ?", [table.last_rowid])
|
{"id": 1, "title": "Exists"}
|
||||||
) == [{"id": 1, "title": "Exists"}]
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("rowid_alias", ("rowid", "_rowid_", "oid"))
|
@pytest.mark.parametrize("rowid_alias", ("rowid", "_rowid_", "oid"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue