Skip to content

Commit

Permalink
update connection settings to allow multiple sources
Browse files Browse the repository at this point in the history
  • Loading branch information
knl88 committed May 21, 2024
1 parent 2975c31 commit 25dbef2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion dscreator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

class Settings(BaseSettings):
# postgresql:///odm2?host=timescale-db&port=5432&user=postgres&password=postgres
database_url: str = ""
odm2_connection_str: str = ""
tsb_connection_str: str = ""
# gs://nivatest-1-senda
storage_path: str = "./catalog"

Expand Down
6 changes: 3 additions & 3 deletions dscreator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def msource_inlet(max_time_slice: int = 24, stop_after_n_files: int = -1, acdd:

logging.info("Exporting MSOURCE dataset")

engine = create_engine(SETTINGS.database_url)
engine = create_engine(SETTINGS.odm2_connection_str)

timeseries_extractor = odm2.extractor.TimeseriesExtractor(
engine,
Expand Down Expand Up @@ -63,7 +63,7 @@ def msource_outlet(max_time_slice: int = 24, stop_after_n_files: int = -1, acdd:

logging.info("Exporting MSOURCE dataset")

engine = create_engine(SETTINGS.database_url)
engine = create_engine(SETTINGS.odm2_connection_str)
timeseries_extractor = odm2.extractor.TimeseriesExtractor(
engine,
sampling_feature_code="MSOURCE2",
Expand Down Expand Up @@ -97,7 +97,7 @@ def sios(max_time_slice: int = 24, stop_after_n_files: int = -1, acdd: bool = Fa
"""

logging.info("Exporting SIOS dataset")
engine = create_engine(SETTINGS.database_url)
engine = create_engine(SETTINGS.odm2_connection_str)
timeseries_extractor = odm2.extractor.TimeseriesExtractor(
engine,
sampling_feature_code="bbee7983-e91c-4282-9a5d-d0894a9b7cb0",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/norsoop-2017-2022.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
}
],
"source": [
"engine = create_engine(SETTINGS.database_url)\n",
"engine = create_engine(SETTINGS.tsb_connection_str)\n",
"variable_uuid_map = MAPPER[f\"{boat}_19\"]\n",
"traj_extractor = TrajectoryExtractor(engine, measurement_parameters, variable_uuid_map, [1])\n",
"nc_paths = []\n",
Expand Down
2 changes: 1 addition & 1 deletion scripts/msource_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from dscreator.sources.odm2.extractor import TimeseriesExtractor

# %%
engine = create_engine(SETTINGS.database_url)
engine = create_engine(SETTINGS.odm2_connection_str)
# %%
start_time = datetime(2022, 9, 23)
extractor = TimeseriesExtractor(engine, "MSOURCE1", ["Turbidity", "LevelValue"])
Expand Down

0 comments on commit 25dbef2

Please sign in to comment.