Skip to main content

Provide an Abstract Base Class for PEP249 compliant databases

Project description

dbapi2abc

This package provides abstract classes to present an interface to PEP249 compliant database Connection and Cursor objects.

This allows you to use type hints on functions handling database connections and cursors without needing to specify the specific backend database engine being used.

from dbapi2abc import Connection, Cursor

class MyObject():
    def __init__(self, db: Connection):
        self.db = db

    def run_some_query(self) -> Cursor:
        cur = self.db.cursor()
        cur.execute("SELECT * FROM Table")
        return cur

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

dbapi2abc-1.1.0.tar.gz (7.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: dbapi2abc-1.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.2

File hashes

Hashes for dbapi2abc-1.1.0.tar.gz
Algorithm Hash digest
SHA256 16fbb34881f5860af3d6d2780b22138fd027f7a956258a336b5cba14b1678367
MD5 4df7ebe7926d20e9733f4af378750b00
BLAKE2b-256 b3efa51149903d9f177fe5cd0b51f4b2327572af590488be992d94214c16945e

See more details on using hashes here.

Supported by

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