Closed dovinmu closed 4 months ago
the reason that the sql query isn't being built properly is in this line in datasette_embeddings/__init__.py
:
db = datasette.get_database(database)
pk_join = " and ".join(
[
f"{table}.{column} = _embeddings_{table}.{column}"
for column in await db.primary_keys(table)
]
)
Looks like it's because citation
doesn't have a primary key column.
hmm, the command to make hash_id
a primary key failed–are there duplicate hash ids?
sqlite-utils transform aphis_reports.db citations --pk hash_id
sqlite3.IntegrityError: UNIQUE constraint failed: citations_new_578bb1e8a3cc.hash_id
okayyy, I just had to make rowid
the primary key. it's already the pk for _embeddings_citations, and initial queries seem to indicate that it's working: searching for 'bobcat' returned entries about a bobcat, searching for 'funky' returned an entry for spoiled food.
adding the command to create-db
in makefile in #19
see #3 for info on what it's currently doing.