Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from .adapters.aiosqlite import AioSQLiteAdapter
from .adapters.asyncpg import AsyncPGAdapter
from .adapters.psycopg2 import PsycoPG2Adapter
from .adapters.sqlite3 import SQLite3DriverAdapter
from .exceptions import SQLLoadException, SQLParseException
from .patterns import (
query_name_definition_pattern,
empty_pattern,
doc_comment_pattern,
valid_query_name_pattern,
)
_ADAPTERS = {
"aiosqlite": AioSQLiteAdapter,
"asyncpg": AsyncPGAdapter,
"psycopg2": PsycoPG2Adapter,
"sqlite3": SQLite3DriverAdapter,
}
def register_driver_adapter(driver_name, driver_adapter):
"""Registers custom driver adapter classes to extend ``aiosql`` to to handle additional drivers.
For details on how to create a new driver adapter see the documentation
`link `_.
TODO: Make a link to the documentation when it exists.
Args:
driver_name (str): The driver type name.
driver_adapter (callable): Either n class or function which creates an instance of a