mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-10 02:24:22 +02:00
.transform() on rowid (non-pk) tables bug fix, closes #284
This commit is contained in:
parent
5b257949d9
commit
0e797033f9
5 changed files with 100 additions and 16 deletions
|
|
@ -126,12 +126,25 @@ def test_extract_rowid_table(fresh_db):
|
|||
fresh_db["tree"].extract(["common_name", "latin_name"])
|
||||
assert fresh_db["tree"].schema == (
|
||||
'CREATE TABLE "tree" (\n'
|
||||
" [rowid] INTEGER PRIMARY KEY,\n"
|
||||
" [name] TEXT,\n"
|
||||
" [common_name_latin_name_id] INTEGER,\n"
|
||||
" FOREIGN KEY([common_name_latin_name_id]) REFERENCES [common_name_latin_name]([id])\n"
|
||||
")"
|
||||
)
|
||||
assert (
|
||||
fresh_db.execute(
|
||||
"""
|
||||
select
|
||||
tree.name,
|
||||
common_name_latin_name.common_name,
|
||||
common_name_latin_name.latin_name
|
||||
from tree
|
||||
join common_name_latin_name
|
||||
on tree.common_name_latin_name_id = common_name_latin_name.id
|
||||
"""
|
||||
).fetchall()
|
||||
== [("Tree 1", "Palm", "Arecaceae")]
|
||||
)
|
||||
|
||||
|
||||
def test_reuse_lookup_table(fresh_db):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue