Skip to content

Commit

Permalink
change db connection string for gdal
Browse files Browse the repository at this point in the history
  • Loading branch information
conbrad committed Oct 3, 2024
1 parent 2629811 commit fe0589d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/app/auto_spatial_advisory/process_fuel_type_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions api/app/db/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit fe0589d

Please sign in to comment.