Skip to content

Commit

Permalink
Rewrite client/server and rename pq (for publish/query).
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed May 13, 2024
1 parent 9a20629 commit 5901a36
Show file tree
Hide file tree
Showing 7 changed files with 1,174 additions and 129 deletions.
File renamed without changes.
58 changes: 0 additions & 58 deletions python/lsst/consdb/client.py

This file was deleted.

18 changes: 3 additions & 15 deletions python/lsst/consdb/hinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
import yaml
from astro_metadata_translator import ObservationInfo
from lsst.resources import ResourcePath
from sqlalchemy import MetaData, Table, create_engine
from sqlalchemy import MetaData, Table
from sqlalchemy.dialects.postgresql import insert
from utils import setup_postgres

###############################
# Header Processing Functions #
Expand Down Expand Up @@ -287,20 +288,7 @@ def get_kafka_config() -> KafkaConfig:
instrument_mapping = LSSTCAM_MAPPING
logging.info(f"Instrument = {instrument}")

host = os.environ.get("DB_HOST")
passwd = os.environ.get("DB_PASS")
user = os.environ.get("DB_USER")
dbname = os.environ.get("DB_NAME")
pg_url = ""
if host and passwd and user and dbname:
logging.info(f"Connecting to {host} as {user} to {dbname}")
pg_url = f"postgresql://{user}:{passwd}@{host}/{dbname}"
else:
pg_url = os.environ.get(
"POSTGRES_URL", "postgresql://usdf-butler.slac.stanford.edu:5432/lsstdb1"
)
logging.info(f"Using POSTGRES_URL {user} {host} {dbname}")
engine = create_engine(pg_url)
engine = setup_postgres()
metadata_obj = MetaData(schema=f"cdb_{instrument.lower()}")
exposure_table = Table("exposure", metadata_obj, autoload_with=engine)

Expand Down
Loading

0 comments on commit 5901a36

Please sign in to comment.