Skip to content
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

wip: postgres integration #959

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

iparask
Copy link
Member

@iparask iparask commented Sep 20, 2024

This is to continue the discussion about postgres as the metadata DB. I made some changes in ObsDB to connect to a postgres and run most of the ObsDB commands. I want to do some extra updates and then fix the unit test.

Having said that the size of the changes is not significant in terms of code that is changed. It is more to make sure the SQL code is correct.

Let me know what you think, because I will have to discuss it also with Research Computing at Princeton to have the ability to connect from the compute nodes.

@iparask iparask changed the title wip: postres integration wip: postgres integration Sep 25, 2024
import gzip
import os

GET_TABLE_CREATE = """with table_info as (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was the schema being created before?

Wouldn't it be best to have this as part of a migration script, through alembic or similar, if we're not using an ORM?

Copy link
Member Author

@iparask iparask Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to dump an existing DB to a file, similar to SQLite to file function. I do not know how the schema is created. @mhasself can you provide some more information here?

"`tag` varchar(256)",
"CONSTRAINT one_tag UNIQUE (`obs_id`, `tag`)",
"tags": [
"obs_id varchar(256)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obs_id is not a foreign key?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it is not. I think it should be and it will make search and joins even faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants