pydal-psycopg3
pydal-psycopg3 is a proof-of-concept driver for pyDAL, demonstrating integration
with psycopg3 as a drop-in replacement for the psycopg2 driver. The goal is to
ensure databases relying on psycopg2 functionality can seamlessly transition to psycopg3 while preserving the same
driver schemes.
Key Features
- Drop-In Replacement: The module is designed to work with existing
psycopg2configurations. - Custom Scheme Support: Supports both the original "postgres" scheme and a custom "postgres:psycopg3" scheme for explicit usage.
- Compatibility with pyDAL: Built as a registerable driver, compatible with the DAL object.
Installation
To use this driver, install the package and its dependencies:
(uv) pip install pydal-psycopg3
# or to include the prebuilt driver:
(uv) pip install pydal-psycopg3 psycopg-binary
Getting Started
To integrate pydal-psycopg3, use the following setup:
from pydal import DAL
# Required to register the driver
import pydal_psycopg3
# Using the original scheme
db = DAL("postgres://someuser:somepass@localhost:5432/postgres")
# Or using the explicit psycopg3 scheme
db = DAL("postgres:psycopg3://someuser:somepass@localhost:5432/postgres")
Both approaches ensure the driver works transparently.
Example Usage
- Define tables and perform queries just like with
psycopg2. Here's a minimal example to get started:
# Defining a table
db.define_table("example_table", db.Field("example_field"))
# Inserting data
db.example_table.insert(example_field="test data")
db.commit()
# Querying the table
rows = db(db.example_table).select()
print(rows)
Driver Registration
The driver registers itself automatically when imported and works with either of the following schemes:
postgres://– The default scheme connects usingpsycopg3as the driver.postgres:psycopg3://– An explicitly declared scheme to usepsycopg3.
Limitations
This module is in its proof-of-concept phase and should be used with caution in production environments. While most functionalities are expected to work as intended, thorough testing is recommended.
License
This project is licensed under the MIT License.
Metadata
Release files for pydal-psycopg3 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydal_psycopg3-0.1.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydal_psycopg3-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / pydal_psycopg3-0.1.1.tar.gz
| Download URL | pydal_psycopg3-0.1.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2139c7402541b1636e4c49a8d0c604bd3c7d9febb508fac1d37efc839f5a3248
|
|
BLAKE2b-256 checksum How to use checksums |
4fae7a3903782bc241e0f5cbfad1c3984596bb3ad22f164226e1feddfe8db28f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / pydal_psycopg3-0.1.1-py3-none-any.whl
| Download URL | pydal_psycopg3-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
043542070619f396514d8bcd57ab2dd4f7279be871a624a4f0970fb96e3bf527
|
|
BLAKE2b-256 checksum How to use checksums |
1dc7c000f147d86928af8d96b2491642aec724bc25ffa56d9b2ad51551398ffc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|