shillelagh.backends.apsw.dialects package¶
Submodules¶
shillelagh.backends.apsw.dialects.base module¶
A SQLALchemy dialect.
- class shillelagh.backends.apsw.dialects.base.APSWDialect(adapters: list[str] | None = None, adapter_kwargs: dict[str, dict[str, Any]] | None = None, safe: bool = False, **kwargs: Any)[source]¶
Bases:
SQLiteDialectA SQLAlchemy dialect for Shillelagh.
The dialect is based on the
SQLiteDialect, since we’re using APSW.- colspecs: dict[TypeEngine, TypeEngine] = {}¶
A dictionary of TypeEngine classes from sqlalchemy.types mapped to subclasses that are specific to the dialect class. This dictionary is class-level only and is not accessed from the dialect instance itself.
- create_connect_args(url: URL) tuple[tuple[()], dict[str, Any]][source]¶
Build DB-API compatible connection arguments.
Given a
URLobject, returns a tuple consisting of a(*args, **kwargs)suitable to send directly to the dbapi’s connect function. The arguments are sent to theDialect.connect()method which then runs the DBAPI-levelconnect()function.The method typically makes use of the
URL.translate_connect_args()method in order to generate a dictionary of options.The default implementation is:
def create_connect_args(self, url): opts = url.translate_connect_args() opts.update(url.query) return ([], opts)
- Parameters:
url – a
URLobject- Returns:
a tuple of
(*args, **kwargs)which will be passed to theDialect.connect()method.
See also
URL.translate_connect_args()
- driver = 'apsw'¶
identifying name for the dialect’s DBAPI
- get_columns(connection: _ConnectionFairy, table_name: str, schema: str | None = None, **kwargs: Any) list[SQLAlchemyColumn][source]¶
Return information about columns in
table_name.Given a
_engine.Connection, a stringtable_name, and an optional stringschema, return column information as a list of dictionaries corresponding to theReflectedColumndictionary.This is an internal dialect method. Applications should use
Inspector.get_columns().
- has_table(connection: _ConnectionFairy, table_name: str, schema: str | None = None, **kwargs: Any) bool[source]¶
Return true if a given table exists.
- name = 'shillelagh'¶
identifying name for the dialect from a DBAPI-neutral point of view (i.e. ‘sqlite’)
- supports_sane_rowcount = False¶
Indicate whether the dialect properly implements rowcount for
UPDATEandDELETEstatements.
- supports_statement_cache = True¶
indicates if this dialect supports caching.
All dialects that are compatible with statement caching should set this flag to True directly on each dialect class and subclass that supports it. SQLAlchemy tests that this flag is locally present on each dialect subclass before it will use statement caching. This is to provide safety for legacy or new dialects that are not yet fully tested to be compliant with SQL statement caching.
Added in version 1.4.5.
See also
engine_thirdparty_caching
- class shillelagh.backends.apsw.dialects.base.ComputedColumn[source]¶
Bases:
TypedDictA custom type for a computed column in SQLAlchemy.
- class shillelagh.backends.apsw.dialects.base.SQLAlchemyColumn[source]¶
Bases:
TypedDictA custom type for a SQLAlchemy column.
- computed: ComputedColumn | None¶
- type: TypeEngine¶
- shillelagh.backends.apsw.dialects.base.get_adapter_for_table_name(connection: _ConnectionFairy, table_name: str) Adapter[source]¶
Return an adapter associated with a connection.
This function instantiates the adapter responsible for a given table name, using the connection to properly pass any adapter kwargs.
shillelagh.backends.apsw.dialects.gsheets module¶
shillelagh.backends.apsw.dialects.metricflow module¶
shillelagh.backends.apsw.dialects.safe module¶
A “safe” Shillelagh dialect.
When this dialect is used only adapters marked as safe and explicitly listed are loaded.
- class shillelagh.backends.apsw.dialects.safe.APSWSafeDialect(adapters: list[str] | None = None, adapter_kwargs: dict[str, dict[str, Any]] | None = None, **kwargs: Any)[source]¶
Bases:
APSWDialectA “safe” Shillelagh dialect.
This dialect can be used with the shillelagh+safe:// URI:
>>> from sqlalchemy.engine import create_engine >>> engine = create_engine("shillelagh+safe://", adapters=["socrata"])
The dialect only loads the adapters explicitly listed (“socrata”, in the example above), and only if they’re marked as safe.
- create_connect_args(url: URL) tuple[tuple[()], dict[str, Any]][source]¶
Build DB-API compatible connection arguments.
Given a
URLobject, returns a tuple consisting of a(*args, **kwargs)suitable to send directly to the dbapi’s connect function. The arguments are sent to theDialect.connect()method which then runs the DBAPI-levelconnect()function.The method typically makes use of the
URL.translate_connect_args()method in order to generate a dictionary of options.The default implementation is:
def create_connect_args(self, url): opts = url.translate_connect_args() opts.update(url.query) return ([], opts)
- Parameters:
url – a
URLobject- Returns:
a tuple of
(*args, **kwargs)which will be passed to theDialect.connect()method.
See also
URL.translate_connect_args()
- supports_statement_cache = True¶
indicates if this dialect supports caching.
All dialects that are compatible with statement caching should set this flag to True directly on each dialect class and subclass that supports it. SQLAlchemy tests that this flag is locally present on each dialect subclass before it will use statement caching. This is to provide safety for legacy or new dialects that are not yet fully tested to be compliant with SQL statement caching.
Added in version 1.4.5.
See also
engine_thirdparty_caching