Runtime components for code generated by sqlc
Project description
sqlc-python-runtime
A small runtime library for python code generated by 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:
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sqlc-python-runtime-1.0.1.tar.gz
.
File metadata
- Download URL: sqlc-python-runtime-1.0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6238e7b308b46a47a1bc19bd8e378988d620e7decb080c2ed07138bfd6f1b91d |
|
MD5 | 358a293b17d429073b4b79076012363d |
|
BLAKE2b-256 | fbbb8a1559ca212f9e851c61223637a2f51754946ef2521b86fb43d02964ed5a |
File details
Details for the file sqlc_python_runtime-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: sqlc_python_runtime-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.9.1 Linux/5.4.0-1039-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05d46ea32e71dd5c2a28ab9403e412631375eb86cecf62d7f85dff24b5631249 |
|
MD5 | ea861d435e906025fa18205cd01e1eef |
|
BLAKE2b-256 | 030d37e1f4e3958f1fb720ad2402b433a73b294060e47e60013d8f2bda359cca |