Closed andreaswimmer closed 6 hours ago
import random import libsql_experimental as libsql conn = libsql.connect(":memory:") dims = 4 conn.execute(f""" CREATE TABLE vectors ( vector_id INTEGER PRIMARY KEY, vector F32_BLOB({dims}) ) """) conn.execute("CREATE INDEX vector_idx ON vectors(libsql_vector_idx(vector))") data = [] for primary in range(10): vector = ','.join(str(random.random()) for _ in range(dims)) data.append((primary, f"[{vector}]")) conn.executemany(""" INSERT INTO vectors values (?, ?) """, data) print(conn.execute("SELECT COUNT(*) FROM vectors").fetchall()) print(conn.execute("SELECT * FROM vectors").fetchall())
In this program, count(*) returns 0, even though the table has 10 rows. If you comment out the 'CREATE INDEX' line, the correct answer of 10 is given.
Using libsql-experimental 0.0.41
Just saw libsql-experimental has its own issue tracker, will post over there
Feel free to delete this, I don't think I can
In this program, count(*) returns 0, even though the table has 10 rows. If you comment out the 'CREATE INDEX' line, the correct answer of 10 is given.
Using libsql-experimental 0.0.41