Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions site/using/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ db.execute(
) # 4
```

### Reading Vectors

When reading vectors from a SQLite database, you can use the `vec_to_json()` function to convert the BLOB format into a JSON array.

```python
import json

db.execute("CREATE TABLE test (embedding BLOB)")
db.execute("INSERT INTO test VALUES (?)", [serialize_float32([0.1, 0.2, 0.3, 0.4])])

json_str, = db.execute("SELECT vec_to_json(embedding) FROM test").fetchone()
print(json.loads(json_str)) # [0.1, 0.2, 0.3, 0.4]
```


## Using an up-to-date version of SQLite {#updated-sqlite}

Expand Down