Alchemy Feed

class forml.provider.feed.alchemy.Feed(sources: Mapping[dsl.Source | str, str], **readerkw)[source]

Bases: Feed[Selectable, ColumnElement]

Generic SQL feed based on SQLAlchemy.

All the hosted datasets need to be declared using a proper content resolver mapping specified using the sources option with keys representing the fully qualified schema name formatted as <full.module.path>:<qualified.Class.Name> and the values should refer to the physical table names like <database>.<table>.

Attention

All the referenced schema catalogs must be installed.

Parameters:
sources: Mapping[dsl.Source | str, str]

The mapping of schema catalogs to the DB tables.

**readerkw

Optional keywords typically for the pandas.read_sql.

The provider can be enabled using the following platform configuration:

config.toml
 [FEED.sql]
 provider = "alchemy"
 connection = "mysql+pymysql://john:smith@localhost/"
 [FEED.sql.sources]
 "openschema.kaggle:Titanic" = "kaggle.titanic"
 "foobar.schemas:Foo.Baz" = "foobar.baz"

Important

Select the sql extras to install ForML together with the SQLAlchemy support.