flexmeasures.cli.db_ops

CLI commands for saving, resetting, etc of the database

Functions

flexmeasures.cli.db_ops.libpq_uri(sqlalchemy_uri: str | None) → str

Turn a SQLAlchemy database URI into one that libpq tools (pg_dump, pg_restore) accept.

libpq does not know SQLAlchemy’s driver names (e.g. postgresql+psycopg2://), and would read such a URI as the name of a database on the local socket.