Skip to main content

Core abstraction hierarchy for pydbc — Driver, DriverManager, Connection, Statement, PreparedStatement, ResultSet, DataSource

Project description

alt-python-pydbc-core

Core abstraction layer for pydbc — the uniform database access library for Python.

This package provides the ABCs, registries, and generic helpers that all pydbc driver packages depend on. You do not normally install this package directly. Install the driver package for your database; alt-python-pydbc-core is pulled in automatically as a dependency.

# Install the driver for your database — core is a transitive dependency
uv add alt-python-pydbc-sqlite    # SQLite
uv add alt-python-pydbc-pg        # PostgreSQL
uv add alt-python-pydbc-mysql     # MySQL / MariaDB
uv add alt-python-pydbc-mssql     # SQL Server

What this package provides

ABCs (Abstract Base Classes)

Class Purpose
Driver Abstract base for all pydbc drivers
Connection Abstract connection handle
Statement Execute arbitrary SQL
PreparedStatement Execute pre-compiled SQL with bound parameters
ResultSet Row access after a query
DataSource Connection factory abstraction
ConnectionPool Connection pool abstraction

DriverManager

Central registry that maps connection URLs to registered drivers. Driver packages self-register at import time by calling DriverManager.register_driver().

import pydbc_sqlite  # registers SQLiteDriver
from pydbc_core import DriverManager

conn = DriverManager.get_connection("pydbc:sqlite::memory:")
stmt = conn.create_statement()
rs = stmt.execute_query("SELECT 42 AS n")
print(rs.rows)   # [(42,)]
conn.close()

GenericDbApiDriver

A reusable base driver that wraps any DB-API 2.0 module. Driver packages typically subclass this; it handles connection lifecycle, cursor management, and paramstyle normalisation automatically.

DataSource helpers

Class When to use
SingleConnectionDataSource Tests and scripts that need one persistent connection
PooledDataSource Servers and applications that need a connection pool
NamedParameterDataSource Convenience wrapper with named-parameter query/update methods

ParamstyleNormalizer

Rewrites SQL written with ? (positional) or :name (named) placeholders to whatever the underlying DB-API 2.0 driver expects (%s, %(name)s, :1, etc.). This means you write SQL once and it works against any driver.


Documentation


License

MIT

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

alt_python_pydbc_core-1.0.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

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

alt_python_pydbc_core-1.0.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file alt_python_pydbc_core-1.0.0.tar.gz.

File metadata

  • Download URL: alt_python_pydbc_core-1.0.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alt_python_pydbc_core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 00bb2bd9f8f5c2dd02b57bfdcdb24a779e10041e516a836a8527ebbf6da45913
MD5 1d4eaf18f7f5daf9f4e4147f0003878a
BLAKE2b-256 421f8ab7c7e8ab3d5ee4bb30d1f6bd850e1cd4f7e351bf2c3a7a0c08078b1f5e

See more details on using hashes here.

File details

Details for the file alt_python_pydbc_core-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: alt_python_pydbc_core-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alt_python_pydbc_core-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fc850ae133edb43896ba0be6f319d4f98f19216231a0943c6a215300a54f3eb
MD5 190e0aa10fb7ee4080bd831146b023d2
BLAKE2b-256 6c84d2314ac3aad60c69d9135609b9253ce0ff4e68cdbb911c60ef203a47145a

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