From 12926707ae427eb1bdb5bf6ad58ff0ef37a62f8c Mon Sep 17 00:00:00 2001 From: Kilian Helfenbein Date: Thu, 6 Feb 2025 13:44:06 +0100 Subject: [PATCH] allow to use egon-data configuration files without setting up an ssh tunnel internally --- edisgo/io/db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edisgo/io/db.py b/edisgo/io/db.py index e920dee47..a2fc1ac8c 100644 --- a/edisgo/io/db.py +++ b/edisgo/io/db.py @@ -168,7 +168,7 @@ def engine(path: Path | str = None, ssh: bool = False) -> Engine: """ - if not ssh: + if path is None: database_url = "toep.iks.cs.ovgu.de" return create_engine( "postgresql+oedialect://:@" f"{database_url}", @@ -176,7 +176,8 @@ def engine(path: Path | str = None, ssh: bool = False) -> Engine: ) cred = credentials(path=path) - local_port = ssh_tunnel(cred) + + local_port = ssh_tunnel(cred) if ssh else int(cred["--database-port"]) return create_engine( f"postgresql+psycopg2://{cred['POSTGRES_USER']}:"