Metadata-Version: 2.4
Name: schema-first-query
Version: 0.1.0
Summary: Introspect a live database and generate typed, autocomplete-friendly query helpers — no ORM required.
License: MIT
Keywords: database,typing,sql,query,schema,typeddict,dataclass
Author: schema-first-query contributors
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Provides-Extra: all
Provides-Extra: async-mysql
Provides-Extra: async-postgres
Provides-Extra: async-sqlite
Provides-Extra: mysql
Provides-Extra: postgres
Requires-Dist: aiomysql (>=0.2,<0.3) ; extra == "async-mysql" or extra == "all"
Requires-Dist: aiosqlite (>=0.20,<0.21) ; extra == "async-sqlite" or extra == "all"
Requires-Dist: asyncpg (>=0.29,<0.30) ; extra == "async-postgres" or extra == "all"
Requires-Dist: click (>=8.1,<9.0)
Requires-Dist: psycopg2-binary (>=2.9,<3.0) ; extra == "postgres" or extra == "all"
Requires-Dist: pymysql (>=1.1,<2.0) ; extra == "mysql" or extra == "all"
Project-URL: Documentation, https://github.com/schema-first-query/schema-first-query#readme
Project-URL: Homepage, https://github.com/schema-first-query/schema-first-query
Project-URL: Repository, https://github.com/schema-first-query/schema-first-query
Description-Content-Type: text/markdown

# schema-first-query

[![PyPI version](https://img.shields.io/pypi/v/schema-first-query.svg)](https://pypi.org/project/schema-first-query/)
[![Python versions](https://img.shields.io/pypi/pyversions/schema-first-query.svg)](https://pypi.org/project/schema-first-query/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Coverage](https://img.shields.io/badge/coverage-%E2%89%A580%25-brightgreen.svg)](https://github.com/schema-first-query/schema-first-query)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)

**Introspect a live database and get typed, autocomplete-friendly query helpers — no ORM, no model classes, no boilerplate.**

---

## Motivation

Python developers working with relational databases face an uncomfortable tradeoff. Raw SQL with `dict` rows is fast and flexible, but offers no type safety, no IDE autocomplete, and fragile string-key access that breaks silently when columns are renamed. Full ORMs like SQLAlchemy or Django ORM are typed and ergonomic, but they require maintaining Python model classes that duplicate the database schema — a form of drift-prone redundancy that grows more painful as the schema evolves.

The middle ground — lightweight query builders like SQLAlchemy Core or PyPika — reduces boilerplate but still returns untyped rows, or requires you to write `TypedDict` definitions by hand. Either way, the schema lives in two places: the database and your Python code.

`schema-first-query` eliminates that duplication. It connects to your database (or reads your SQL migration files), introspects the schema once, and generates `TypedDict` or `dataclass` types on the fly. Your IDE sees fully typed results with autocomplete. Your code stays DRY. The database schema remains the single source of truth — exactly as it should be in a database-first workflow.

---

## Installation


