Skip to main content

Python helper package for interacting with Cardano DB Sync databases

Project description

dbsync-py

Test Suite Documentation PyPI version Python Support License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbsync_py-1.0.0.dev8.tar.gz (276.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbsync_py-1.0.0.dev8-py3-none-any.whl (102.3 kB view details)

Uploaded Python 3

File details

Details for the file dbsync_py-1.0.0.dev8.tar.gz.

File metadata

  • Download URL: dbsync_py-1.0.0.dev8.tar.gz
  • Upload date:
  • Size: 276.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.17

File hashes

Hashes for dbsync_py-1.0.0.dev8.tar.gz
Algorithm Hash digest
SHA256 341bda76fe2e3c8e6d78b4cf3a9c300c0c14108115c8005fdba125b633a1b25a
MD5 1133efef9217101f917550300ba7b928
BLAKE2b-256 935fb1d1f93fc569632c8bc15bf05eaa64ee8075a71e8cd5b0e9223266194ff1

See more details on using hashes here.

File details

Details for the file dbsync_py-1.0.0.dev8-py3-none-any.whl.

File metadata

File hashes

Hashes for dbsync_py-1.0.0.dev8-py3-none-any.whl
Algorithm Hash digest
SHA256 ded78c886f6c00cb5e2d1ecc1d6a4c5995854faed51755b23caa01a89ce869f8
MD5 b53843b1affe4076e76fe0510c9370cc
BLAKE2b-256 dce7e0a3ced5eb89db47f96cf009bc10ea2f30f9c537429230f47d02cbb65f20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page