intake_sqlite#

A template repository for a Python package created by Catalyst Cooperative.

Submodules#

Package Contents#

Classes#

SQLiteCatalog

Automatically create data sources from known SQLite database tables.

SQLiteSource

Read the full results of an SQL query into a dataframe.

SQLiteSourceAutoPartition

SQLite Table reader with automatic partitioning.

SQLiteSourceManualPartition

SQLite expression reader with explicit partitioning.

Functions#

urlpath_to_sqliteurl(→ str)

Transform a file path or URL into a local SQLite URL.

Attributes#

intake_sqlite.__version__ :str[source]#
class intake_sqlite.SQLiteCatalog(urlpath: str, views: bool = False, sql_kwargs: str | None = None, storage_options: dict[str, Any] = {}, **kwargs: str)[source]#

Bases: intake_sql.sql_cat.SQLCatalog

Automatically create data sources from known SQLite database tables.

name = sqlite_cat#
version#
class intake_sqlite.SQLiteSource(urlpath: str, sql_expr: str, sql_kwargs: dict[str, Any] = {}, metadata: dict[str, Any] = {}, storage_options: dict[str, Any] = {})[source]#

Bases: intake_sql.SQLSource

Read the full results of an SQL query into a dataframe.

Parameters:
  • urlpath – A local path or fsspec readable URL pointing to a SQLite database.

  • sql_expr – Query expression to pass to the SQLite database backend.

  • sql_kwargs – Additional arguments to pass in to pandas.read_sql().

  • metadata – Arbitrary metadata dictionary associated with the data source.

  • storage_options – Keyword arguments passed to fsspec.open_local()

name = sqlite#
version#
container = dataframe#
partition_access = True#
class intake_sqlite.SQLiteSourceAutoPartition(urlpath: str, table: str, index: str, sql_kwargs: dict[str, Any] = {}, metadata: dict[str, Any] = {}, storage_options: dict[str, Any] = {})[source]#

Bases: intake_sql.SQLSourceAutoPartition

SQLite Table reader with automatic partitioning.

Parameters:
  • urlpath – A local path or fsspec readable URL pointing to a SQLite database.

  • table – Name of the table to read from the database.

  • index – Name of the column to use for partitioning and as the index of the resulting dataframe.

  • sql_kwargs – Additional arguments to pass to dask.dataframe.read_sql().

  • metadata – Arbitrary metadata dictionary associated with the data source.

  • storage_options – Keyword arguments passed to fsspec.open_local()

name = sqlite_auto#
version#
container = dataframe#
partition_access = True#
class intake_sqlite.SQLiteSourceManualPartition(urlpath: str, sql_expr: str, where_values: list[Any], where_template: str | None = None, sql_kwargs: dict[str, Any] = {}, metadata: dict[str, Any] = {}, storage_options: dict[str, Any] = {})[source]#

Bases: intake_sql.SQLSourceManualPartition

SQLite expression reader with explicit partitioning.

Parameters:
  • urlpath – A local path or fsspec readable URL pointing to a SQLite database.

  • sql_expr – Query expression to pass to the SQLite database backend.

  • where_values – list of str or list of values/tuples Either a set of explicit partitioning statements (e.g., “WHERE index_col < 50”…) or pairs of valued to be entered into where_template, if using

  • where_template – str (optional) Template for generating partition selection clauses, using the values from where_values, e.g., “WHERE index_col >= {} AND index_col < {}”

  • sql_kwargs – Additional arguments to pass to dask.dataframe.read_sql().

  • metadata – Arbitrary metadata dictionary associated with the data source.

  • storage_options – Keyword arguments passed to fsspec.open_local()

name = sqlite_manual#
version#
container = dataframe#
partition_access = True#
intake_sqlite.urlpath_to_sqliteurl(urlpath: str, storage_options: dict[str, Any] = {}) str[source]#

Transform a file path or URL into a local SQLite URL.

intake_sqlite.__author__ = Catalyst Cooperative[source]#
intake_sqlite.__contact__ = pudl@catalyst.coop[source]#
intake_sqlite.__maintainer__ = Zane Selvans[source]#
intake_sqlite.__maintainer_email__ = zane.selvans@catalyst.coop[source]#
intake_sqlite.__license__ = MIT License[source]#
intake_sqlite.__docformat__ = restructuredtext en[source]#
intake_sqlite.__description__ = An Intake driver to access local or remote SQLite databases by URL.[source]#
intake_sqlite.__projecturl__ = https://github.com/catalyst-cooperative/intake-sqlite[source]#
intake_sqlite.__downloadurl__ = https://github.com/catalyst-cooperative/intake-sqlite[source]#
intake_sqlite.logger[source]#