diff --git a/api/app/auto_spatial_advisory/process_fuel_type_area.py b/api/app/auto_spatial_advisory/process_fuel_type_area.py index 0421b7e66..6e2aa2339 100644 --- a/api/app/auto_spatial_advisory/process_fuel_type_area.py +++ b/api/app/auto_spatial_advisory/process_fuel_type_area.py @@ -13,7 +13,7 @@ from app import config from app.auto_spatial_advisory.common import get_s3_key from app.auto_spatial_advisory.run_type import RunType -from app.db.database import DB_READ_STRING, get_async_write_session_scope +from app.db.database import DB_READ_STRING, GDAL_DB_STRING, get_async_write_session_scope from app.db.models.auto_spatial_advisory import AdvisoryFuelStats, SFMSFuelType from app.db.crud.auto_spatial_advisory import get_all_hfi_thresholds, get_all_sfms_fuel_types, get_run_parameters_id, store_advisory_fuel_stats @@ -137,7 +137,7 @@ def get_advisory_shape(advisory_shape_id: int, out_dir: str, projection: osr.Spa :return: path to stored advisory shape :rtype: str """ - data_source = ogr.Open(DB_READ_STRING) + data_source = ogr.Open(GDAL_DB_STRING) sql = f"SELECT geom FROM public.advisory_shapes WHERE id={advisory_shape_id}" advisory_layer = data_source.ExecuteSQL(sql) diff --git a/api/app/db/database.py b/api/app/db/database.py index d5f69ea8f..571ff943e 100644 --- a/api/app/db/database.py +++ b/api/app/db/database.py @@ -18,6 +18,8 @@ postgres_port = config.get("POSTGRES_PORT", "5432") postgres_database = config.get("POSTGRES_DATABASE", "wps") +GDAL_DB_STRING = f"PG:host={postgres_write_host} port={postgres_port} dbname={postgres_database} user={write_user} password={postgres_password}" + DB_WRITE_STRING = f"postgresql://{write_user}:{postgres_password}@{postgres_write_host}:{postgres_port}/{postgres_database}" DB_READ_STRING = f"postgresql://{read_user}:{postgres_password}@{postgres_read_host}:{postgres_port}/{postgres_database}"