Skip to content

Commit

Permalink
Added more logs and test access to consdb tables
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubervila committed Oct 16, 2024
1 parent e30acba commit 294d816
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions python/lsst/consdb/efd_transform/dao/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def get_table(self, tablename, schema=None) -> Table:
metadata.reflect(bind=engine)

if schema:
tbl = Table(tablename, metadata, autoload_with=True, schema=schema)
tbl = Table(tablename, metadata, autoload=True, autoload_with=self.get_con(), schema=schema)
else:
tbl = Table(tablename, metadata, autoload_with=True)
tbl = Table(tablename, metadata, autoload=True, autoload_with=self.get_con())
return tbl

def execute(self, stm):
Expand Down
12 changes: 11 additions & 1 deletion python/lsst/consdb/efd_transform/transform_efd.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,22 @@ async def main() -> None:
consdb_url = args.db_conn_str
log.debug(f"ConsDB URL: {consdb_url}")

from dao.base import DBBase
try:
from dao.base import DBBase
from dao.exposure_efd import ExposureEfdDao
from dao.visit_efd import VisitEfdDao
consdb = DBBase(consdb_url)
log.debug(f"ConsDB engine: {consdb.get_db_engine()}")
log.debug(f"ConsDB connection: {consdb.get_con()}")
log.debug("Postgres connection successful")

log.debug("Testing table ExposureEFD")
expdao = ExposureEfdDao(consdb_url)
log.debug(f"ExposureEFD table: {expdao.tbl}")

log.debug("Testing table VisitEFD")
visdao = VisitEfdDao(consdb_url)
log.debug(f"VisitEFD table: {visdao.tbl}")
except Exception as e:
log.error(f"Postgres connection failed: {e}")
sys.exit(1)
Expand Down

0 comments on commit 294d816

Please sign in to comment.