fastastra
fastastra is modeled after fastlite and it allows you to use FastHTML with AstraDB (Cassandra).
Installation
poetry add fastastra
or
pip install fastastra
To connect:
from fastastra.fastastra import AstraDatabase
db = AstraDatabase(token, dbid) # get your token and dbid from https://astra.datastax.com
Basic usage
List tables
db.t
Create a table
cats = db.t.cats
if cats not in db.t:
cats.create(cat_id=uuid.uuid1, name=str, partition_keys='cat_id')
Insert a row
cat_timeuuid = uuid.uuid1()
cats.update(cat_id=cat_timeuuid, name="fluffy")
List all rows
rows = cats()
ANN / vector search
db = AstraDatabase(token, dbid, embedding_model="embed-english-v3.0") # supports all embedding models in LiteLLM using env vars
dogs = db.t.dogs
if dogs not in db.t:
#dogs.create(id=int, name=str, good_boy=bool, embedding=(list[float], 2), pk='id') # specify dimensions in create
dogs.create(id=int, name=str, good_boy=bool, embedding=list[float], pk='id') # infer dimensions from db.embedding_model
dogs.c.good_boy.index()
dogs.c.embedding.index()
dogs.insert(id=2, good_boy=True, name="spike", embedding=[0.1, 0.2])
index_lookukp = dogs.xtra(good_boy=True)
ann_matches = dogs.xtra(embedding=[0.2, 0.2])
Get dataclass and pydantic model
dataclass = cats.dataclass()
model = cats.pydantic_model()
Get a row
print(cats[cat_timeuuid])
Delete a row
cats.delete(cat_timeuuid)
or
cats.delete(str(cat_timeuuid))
Run a FastHTML example:
This example was taken almost verbatim from the FastHTML examples repo. The only change was the dependency, the db connection string, and changing the id from int to uuid1.
uv sync
uv run python examples/todo.py
Metadata
Release files for fastastra 0.1.38
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastastra-0.1.38.tar.gz | 156.2 kB | Without provenance | Details for fastastra-0.1.38.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastastra-0.1.38-py3-none-any.whl | Python 3 | none | any | Details for fastastra-0.1.38-py3-none-any.whl |
Total release size: 169.8 kB
Release files / fastastra-0.1.38.tar.gz
| Download URL | fastastra-0.1.38.tar.gz |
|---|---|
| Size | 156.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3aaab41ceca0bdaf122e1640b7187849299edcb90514e48f588f4dc67bbb3b4
|
|
BLAKE2b-256 checksum How to use checksums |
9338ed1ac2519467ca6381f3eee2b94b8d7a122c018d7c5b6a2f0249225fccd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / fastastra-0.1.38-py3-none-any.whl
| Download URL | fastastra-0.1.38-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
400dcd11aa85f0b81cb845ea39eabc0fad8626b56726defdefd79c74a2f8d034
|
|
BLAKE2b-256 checksum How to use checksums |
628e3236391f6214dcd25390d4544356a070a3bb1fa1d288ec617b2d6cb73610
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Security for fastastra 0.1.38
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.