Python helper package for interacting with Cardano DB Sync databases
Project description
dbsync-py
Python helper package for interacting with Cardano DB Sync databases.
This package provides SQLModel-based ORM models and utilities for interacting with Cardano DB Sync PostgreSQL databases, enabling type-safe access to Cardano blockchain data.
Installation
pip install dbsync-py
Configuration
dbsync-py supports multiple ways to configure database connections:
Option 1: Environment File (.env)
Copy sample.env to .env and modify the values:
cp sample.env .env
# Edit .env with your database configuration
Option 2: Environment Variables
Set environment variables directly:
export DBSYNC_HOST=localhost
export DBSYNC_PORT=5432
export DBSYNC_DATABASE=cexplorer
export DBSYNC_USERNAME=your_username
export DBSYNC_PASSWORD=your_password
Option 3: Complete Database URL
export DBSYNC_DATABASE_URL=postgresql://username:password@localhost:5432/cexplorer
Quick Start
import dbsync_py
# Test database connection
from dbsync_py.utils import quick_connection_check
if quick_connection_check():
print("✅ Database connection successful!")
else:
print("❌ Database connection failed")
# Use database sessions
from dbsync_py.session import get_session_context
with get_session_context() as session:
result = session.execute("SELECT version()")
print(result.scalar())
Development Status
This project is currently in development. Core database connection utilities are implemented.
License
Apache-2.0
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 dbsync_py-1.0.0.dev6.tar.gz.
File metadata
- Download URL: dbsync_py-1.0.0.dev6.tar.gz
- Upload date:
- Size: 276.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
401e4512d3072bc130c12aa89d114b2c6f4ba0a62e8b860b9ffc3c9a740195f9
|
|
| MD5 |
9a6959aceb07bd3c7d69c7d7e2428636
|
|
| BLAKE2b-256 |
f8f78fcd75d4b5b6da8cd2fda470f5db148ea5ef640f0661b396d70b2a3c62ed
|
File details
Details for the file dbsync_py-1.0.0.dev6-py3-none-any.whl.
File metadata
- Download URL: dbsync_py-1.0.0.dev6-py3-none-any.whl
- Upload date:
- Size: 102.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d10b8fc7ccac4bbab2493457066b15ca5a73f32c2dc82472c2658cce59f37b1
|
|
| MD5 |
af448798bbcbea2e5403a49a6db08d1e
|
|
| BLAKE2b-256 |
2427cd76356ddce0f6a8523974350cfef70aba5d5d461da575ce91bac7b0808b
|