edisgo.io.db
¶
Module Contents¶
Functions¶
|
Return a nested dictionary containing the configuration settings. |
|
Return local database connection parameters. |
|
Initialize an SSH tunnel to a remote host according to the input arguments. |
|
Engine for local or remote database. |
|
Provide a transactional scope around a series of operations. |
|
|
|
|
|
Checks if geometry a is completely within geometry b. |
|
- edisgo.io.db.config_settings(path: Path | str) dict[str, dict[str, str | int | Path]] [source]¶
Return a nested dictionary containing the configuration settings.
It’s a nested dictionary because the top level has command names as keys and dictionaries as values where the second level dictionary has command line switches applicable to the command as keys and the supplied values as values.
So you would obtain the
--database-name
configuration setting used by the current invocation ofegon-data
viasettings()["egon-data"]["--database-name"]
- Parameters
path (pathlib.Path or str) – Path to configuration YAML file of egon-data database.
- Returns
Nested dictionary containing the egon-data and optional ssh tunnel configuration settings.
- Return type
- edisgo.io.db.credentials(path: Path | str) dict[str, str | int | Path] [source]¶
Return local database connection parameters.
- Parameters
path (pathlib.Path or str) – Path to configuration YAML file of egon-data database.
- Returns
Complete DB connection information.
- Return type
- edisgo.io.db.ssh_tunnel(cred: dict) str [source]¶
Initialize an SSH tunnel to a remote host according to the input arguments. See https://sshtunnel.readthedocs.io/en/latest/ for more information.
- edisgo.io.db.engine(path: Path | str, ssh: bool = False) sqlalchemy.engine.base.Engine [source]¶
Engine for local or remote database.
- edisgo.io.db.session_scope_egon_data(engine: sqlalchemy.engine.base.Engine)[source]¶
Provide a transactional scope around a series of operations.
- edisgo.io.db.sql_grid_geom(edisgo_obj: edisgo.EDisGo) geoalchemy2.types.Geometry [source]¶
- edisgo.io.db.get_srid_of_db_table(session: sqlalchemy.orm.session.Session, geom_col: sqlalchemy.orm.attributes.InstrumentedAttribute) int [source]¶
- edisgo.io.db.sql_within(geom_a: geoalchemy2.types.Geometry, geom_b: geoalchemy2.types.Geometry, srid: int)[source]¶
Checks if geometry a is completely within geometry b.
- Parameters
geom_a (Geometry) – Geometry within geom_b.
geom_b (Geometry) – Geometry containing geom_a.
srid (int) – SRID geometries are transformed to in order to use the same SRID for both geometries.