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

163 database tweaks #184

Merged
merged 8 commits into from
Dec 3, 2024
Merged

163 database tweaks #184

merged 8 commits into from
Dec 3, 2024

Conversation

astronomerritt
Copy link
Collaborator

@astronomerritt astronomerritt commented Nov 25, 2024

Fixes #163.

  • AdlerData now correctly overwrites database values.
  • The database/table is set up so that there will only ever be one entry for each ssObjectID: i.e. ssObjectID is the primary key and will be unique.
  • On writeout, AdlerData tries to do an INSERT, and if that fails (because the ssObjectID exists), it will instead UPDATE the values in the specified columns.
  • Wrote some unit tests to make sure this works as expected.

I also changed the timestamp column to an MJD and cleaned up the comments in the unit test (sorry!) because I couldn't see what I was doing 😅

At some point I may shift the database code out into its own class, especially when it comes to writing to the MariaDB database on the cloud, but that can happen later.

Review Checklist for Source Code Changes

  • Does pip install still work?
  • Have you written a unit test for any new functions?
  • Do all the units tests run successfully?
  • Does adler run successfully on a test set of input files/databases?
  • Have you used black on the files you have updated to confirm python programming style guide enforcement?

@astronomerritt astronomerritt marked this pull request as ready for review November 25, 2024 11:29
Copy link
Collaborator

@jrob93 jrob93 left a comment

Choose a reason for hiding this comment

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

Looks good! Apologies for the weird _fixed vs fixed spby error. It was literally just something that worked up until sbpy==0.5.0. I now know _single_leading_underscore: weak “internal use” indicator!

@jrob93 jrob93 merged commit 0d3804d into main Dec 3, 2024
10 checks passed
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.

AdlerData should also be able to overwrite rows on write-out
2 participants