BLOB type (Python)
Use the blob type for binary data.
Although you can store binary-encoded vector data in a blob column, you cannot create a vector index or perform a vector search on the column.
Instead, use the vector type to store vector data.
|
Due to a known issue with filtering on |
You can insert binary data to a blob column as a Base64-encoded string with $binary or as a bytes value.
The Python client returns binary data received from the Data API as a bytes value, even if it was inserted as a Base64-encoded string.
from astrapy import DataAPIClient
# Get an existing table
client = DataAPIClient()
database = client.get_database(
"API_ENDPOINT", token="APPLICATION_TOKEN"
)
table = database.get_table("TABLE_NAME")
# Insert binary values
result = table.insert_one(
{
"example_blob": b"=\xfb\xe7m>\xe9x\xd5?I\xfb\xe7",
"another_example_blob": {"$binary": "PfvnbT7peNU/Sfvn"},
"title": "Example",
}
)