diff --git a/python/lsst/consdb/client.py b/python/lsst/consdb/client.py index bee13520..fa7d8fcb 100644 --- a/python/lsst/consdb/client.py +++ b/python/lsst/consdb/client.py @@ -40,9 +40,9 @@ def query( raise e try: response.raise_for_status() - except: + except Exception as ex: print(response.content.decode()) - raise + raise ex arr = response.json() return DataFrame(arr[1:], columns=arr[0]) diff --git a/python/lsst/consdb/header_proc.py b/python/lsst/consdb/header_proc.py index 551684e7..4c9ae206 100644 --- a/python/lsst/consdb/header_proc.py +++ b/python/lsst/consdb/header_proc.py @@ -9,7 +9,7 @@ import httpx import kafkit from lsst.resources import ResourcePath -from sqlalchemy import create_engine, text +from sqlalchemy import create_engine if TYPE_CHECKING: import lsst.resources @@ -30,9 +30,11 @@ def process_resource(resource: lsst.resources.ResourcePath) -> None: content = json.loads(resource.read()) with engine.begin() as conn: + print(conn) # TODO get all fields and tables, do as a transaction # conn.execute( - # text("INSERT INTO exposure (a, b, c, d, e)" " VALUES(:a, :b, :c, :d, :e)"), + # text("INSERT INTO exposure (a, b, c, d, e)" + # " VALUES(:a, :b, :c, :d, :e)"), # [dict(a=content["something"], b=2, c=3, d=4, e=5)], # ) print(f"Processing {resource}: {content[0:100]}") @@ -51,7 +53,7 @@ async def main() -> None: consumer = aiokafka.AIOKafkaConsumer( topic, bootstrap_servers=kafka_cluster, - group_id=kafka_group_id, + group_id=str(kafka_group_id), auto_offset_reset="earliest", ) await consumer.start() diff --git a/python/lsst/consdb/hinfo-latiss.py b/python/lsst/consdb/hinfo-latiss.py index d3e81156..df30508d 100644 --- a/python/lsst/consdb/hinfo-latiss.py +++ b/python/lsst/consdb/hinfo-latiss.py @@ -97,9 +97,9 @@ def logical_or(*bools: Iterable[int | str | None]) -> bool: } TOPIC_MAPPING = { - "LATISS": "ATHeaderService", - "LSSTComCam": "CCHeaderService", - "LSSTCam": "MTHeaderService", + "LATISS": "ATHeaderService", + "LSSTComCam": "CCHeaderService", + "LSSTCam": "MTHeaderService", } @@ -111,10 +111,10 @@ def logical_or(*bools: Iterable[int | str | None]) -> bool: def process_keyword(keyword: str | tuple, info: dict) -> Any: - if type(keyword) == str: + if type(keyword) is str: if keyword in info: return info[keyword] - elif type(keyword) == tuple: + elif type(keyword) is tuple: fn = keyword[0] args = keyword[1:] if all([a in info for a in args]): diff --git a/python/lsst/consdb/server.py b/python/lsst/consdb/server.py index 106c9007..5344db69 100644 --- a/python/lsst/consdb/server.py +++ b/python/lsst/consdb/server.py @@ -1,6 +1,5 @@ from flask import Flask, request -from sqlalchemy import create_engine, MetaData, Table -from sqlalchemy.dialects.postgresql import insert +from sqlalchemy import create_engine, MetaData import sqlalchemy.exc