{"id":16388560,"url":"https://github.com/phact/fastastra","last_synced_at":"2026-03-17T21:34:50.678Z","repository":{"id":251314522,"uuid":"837034557","full_name":"phact/fastastra","owner":"phact","description":"A bit of extra usability for astradb (modeled after fastlite)","archived":false,"fork":false,"pushed_at":"2025-06-03T20:11:37.000Z","size":768,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T15:11:43.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phact.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-02T04:39:43.000Z","updated_at":"2025-06-03T20:11:38.000Z","dependencies_parsed_at":"2024-10-28T15:24:51.349Z","dependency_job_id":"0bae7da3-7697-499c-b756-84594c50344e","html_url":"https://github.com/phact/fastastra","commit_stats":null,"previous_names":["phact/fastastra"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phact/fastastra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phact%2Ffastastra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phact%2Ffastastra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phact%2Ffastastra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phact%2Ffastastra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phact","download_url":"https://codeload.github.com/phact/fastastra/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phact%2Ffastastra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30632018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T04:29:23.966Z","updated_at":"2026-03-17T21:34:50.660Z","avatar_url":"https://github.com/phact.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastastra\n\n[![commits](https://img.shields.io/github/commit-activity/m/phact/fastastra)](https://github.com/phact/fastastra/commits/main)\n[![Github Last Commit](https://img.shields.io/github/last-commit/phact/fastastra)](https://github.com/phact/fastastra/commits/main)\n[![PyPI version](https://badge.fury.io/py/fastastra.svg)](https://badge.fury.io/py/fastastra)\n[![Discord chat](https://img.shields.io/static/v1?label=Chat%20on\u0026message=Discord\u0026color=blue\u0026logo=Discord\u0026style=flat-square)](https://discord.gg/MEFVXUvsuy)\n[![Stars](https://img.shields.io/github/stars/phact/fastastra?style=social)](https://github.com/phact/fastastra/stargazers)\n\nfastastra is modeled after [fastlite](https://github.com/AnswerDotAI/fastlite) and it allows you to use [FastHTML](https://github.com/AnswerDotAI/fasthtml) with AstraDB (Cassandra). \n\n## Installation\n\n    poetry add fastastra\n\nor \n\n    pip install fastastra\n\n\n## To connect:\n\n    from fastastra.fastastra import AstraDatabase\n    db = AstraDatabase(token, dbid) # get your token and dbid from https://astra.datastax.com\n\n## Basic usage\n\n### List tables\n    db.t\n    \n### Create a table\n    cats = db.t.cats\n    if cats not in db.t:\n        cats.create(cat_id=uuid.uuid1, name=str, partition_keys='cat_id')\n\n\n### Insert a row\n    cat_timeuuid = uuid.uuid1()\n    cats.update(cat_id=cat_timeuuid, name=\"fluffy\")\n\n### List all rows\n    rows = cats()\n\n### ANN / vector search\n    db = AstraDatabase(token, dbid, embedding_model=\"embed-english-v3.0\") # supports all embedding models in LiteLLM using env vars\n    dogs = db.t.dogs\n    if dogs not in db.t:\n        #dogs.create(id=int, name=str, good_boy=bool, embedding=(list[float], 2), pk='id') # specify dimensions in create\n        dogs.create(id=int, name=str, good_boy=bool, embedding=list[float], pk='id') # infer dimensions from db.embedding_model\n        dogs.c.good_boy.index()\n        dogs.c.embedding.index()\n\n    dogs.insert(id=2, good_boy=True, name=\"spike\", embedding=[0.1, 0.2])\n\n    index_lookukp = dogs.xtra(good_boy=True)\n    ann_matches = dogs.xtra(embedding=[0.2, 0.2])\n\n### Get dataclass and pydantic model\n    dataclass = cats.dataclass()\n    model = cats.pydantic_model()\n\n### Get a row\n    print(cats[cat_timeuuid])\n\n# Delete a row\n    cats.delete(cat_timeuuid)\n\n or\n\n    cats.delete(str(cat_timeuuid))\n\n\n## Run a FastHTML example:\n\nThis example was taken almost verbatim from [the FastHTML examples repo](https://github.com/AnswerDotAI/fasthtml-example). The only change was the dependency, the db connection string, and changing the id from `int` to `uuid1`.\n\n    uv sync\n\n    uv run python examples/todo.py\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphact%2Ffastastra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphact%2Ffastastra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphact%2Ffastastra/lists"}