Skip to content

Database abstraction layer for PEP249 compliant databases

Notifications You must be signed in to change notification settings

campbsb/dbapi2abc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Database abstraction layer for PEP249 compliant databases

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages