Experimental psycopg3 driver for pydal
Project description
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydal_psycopg3-0.1.1.tar.gz.
File metadata
- Download URL: pydal_psycopg3-0.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2139c7402541b1636e4c49a8d0c604bd3c7d9febb508fac1d37efc839f5a3248
|
|
| MD5 |
26ec7dd95a70a94856d9d81e4da82edf
|
|
| BLAKE2b-256 |
4fae7a3903782bc241e0f5cbfad1c3984596bb3ad22f164226e1feddfe8db28f
|
File details
Details for the file pydal_psycopg3-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pydal_psycopg3-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
043542070619f396514d8bcd57ab2dd4f7279be871a624a4f0970fb96e3bf527
|
|
| MD5 |
f153d6e119836ccb3e0f4a3cce23e35a
|
|
| BLAKE2b-256 |
1dc7c000f147d86928af8d96b2491642aec724bc25ffa56d9b2ad51551398ffc
|