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.1.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.1.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alt_python_pydbc_core-1.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 40966a6d3a88025780334b5dc6dcd89b146894b087c4d04ec1ab68b7ab3575ac
MD5 152757bad3fe4fd2de713d1f3fff308a
BLAKE2b-256 6a427b5e8b77c03e0cb23975bc080175280fe9045ff22da00604c23f2208010e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alt_python_pydbc_core-1.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa36e982244d96ee463ffccc849d3e2778281a3c74d5e053966d2c42d70b1b03
MD5 12590aa4263649e1127d2a39cfa17d7c
BLAKE2b-256 2f0c9f9ef323405b13679ef12328dd1e29e153cd31e4be4d9c01f3dfc09896d0

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