Metadata-Version: 2.1
Name: sqlc-python-runtime
Version: 1.0.1
Summary: Runtime components for code generated by sqlc
Home-page: https://github.com/robholt/sqlc-python-runtime
License: MIT
Author: Robert Holt
Author-email: rholt@datto.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Provides-Extra: asyncpg
Provides-Extra: psycopg2
Requires-Dist: asyncpg (>=0.22.0,<0.23.0); extra == "asyncpg"
Requires-Dist: psycopg2-binary (>=2.8.6,<3.0.0); extra == "psycopg2"
Requires-Dist: pydantic (>=1.4,<2.0)
Description-Content-Type: text/markdown

# sqlc-python-runtime

A small runtime library for python code generated by [sqlc](https://github.com/kyleconroy/sqlc)

## Installation

Add the `sqlc-python-runtime` package to your project's dependencies.

## Usage

All query functions generated by sqlc take a database connection object as their first argument.
This connection object must conform to the `Connection`/`AsyncConnection` interface defined in this package.
This package also provides wrappers for `psycopg2` and `asyncpg` that conform to this interface.

`psycopg2` example:
```python
import psycopg2
from sqlc_runtime.psycopg2 import build_psycopg2_connection


conn = build_psycopg2_connection(psycopg2.connect("postgresql://localhost:5432/mydatabase"))
```

Also note that the generated query functions can use either a `Connection` or an `AsyncConnection`.
If an `AsyncConnection` is passed the result must be awaited. The function type hints communicate this so any type
checkers (like mypy) will raise errors if any are missed or incorrectly used.

