Quickstart
Install
Section titled “Install”uv add lexigram-sqllexigram (core) and lexigram-contracts are pulled in automatically. For Postgres or MySQL, add the driver extra:
uv add "lexigram-sql[postgres]" # asyncpguv add "lexigram-sql[mysql]" # aiomysqlMinimal Setup
Section titled “Minimal Setup”Configure a database and boot it with DatabaseModule:
import asynciofrom lexigram import Applicationfrom lexigram.sql import DatabaseModule
async def main(): async with Application.boot( name="my-app", modules=[DatabaseModule.configure("sqlite+aiosqlite:///example.db")], ) as app: print("Database connected")
asyncio.run(main())Define a Repository
Section titled “Define a Repository”from dataclasses import dataclassfrom lexigram.domain import DomainModelfrom lexigram.sql import GenericRepository
@dataclassclass User(DomainModel): id: int | None = None name: str = "" email: str = ""
repo = GenericRepository[User, int]( provider=db_provider, # resolved from container table_name="users", entity_class=User, key_field="id",)Next Steps
Section titled “Next Steps”- Guide — mental model, repositories, queries, migrations
- How-Tos — task-oriented recipes
- Configuration — every config key