-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-46747 refactor pqserver per SQR-072 #65
base: main
Are you sure you want to change the base?
Conversation
6f6d5e9
to
09e4ecc
Compare
09e4ecc
to
b402b60
Compare
|
||
instrument = instrument.lower() | ||
logger = logging.getLogger() | ||
engine = get_engine() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not have this as a parameter and def get_instrument_table(..., engine = Depends(get_engine)):
|
||
|
||
def get_instrument_list(): | ||
global instrument_list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I think instrument_list
should be a parameter.
python/lsst/consdb/dependencies.py
Outdated
def validate_instrument_name( | ||
instrument: str = Path(description="Must be a valid instrument name (e.g., ``LATISS``)"), | ||
) -> str: | ||
print(f"validate_instrument_name({instrument=})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | ||
|
||
# Check SQLAlchemy version | ||
required_version = (2, 0, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could put this in our requirements.txt or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the version check from the code, but I think setting up requirements.txt or similar calls for a new ticket. The needs of consdb are fairly complicated given that there are several products coming from this repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wanted to add requirements on such a major refactoring, that seems fine - I don't see that needing its own ticket.
Co-authored-by: Valerie <[email protected]>
This divides the functionality in pqserver into separate units. It also switches from using a
Connection
object toSession
objects so that sqlalchemy is managing a connection pool.Note that the error behavior is not preserved by this change. My impression is that no one is relying on the existing error behavior, so it is to our advantage to move to error formats that are provided by FastAPI.