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

add postgresql support and unit testing #78

Merged
merged 11 commits into from
May 25, 2021

Conversation

dnadeau-lanl
Copy link
Contributor

PR Checklist

New code is easier to review, integrate and maintain if it's
consistent with the style of the rest of the dbprocessing code.
Please try to follow as much of this checklist as you can for
your PR. If a given item is not relevant to your PR, please check
it off, add "(N/A)" to the start of the line, and include a
description below the checklist.

If you don't know how to complete something in the checklist, go
ahead and submit the PR as a draft and ask for help.

Some additional suggestions are given below.

Please also see our Code of Conduct so that the dbprocessing community
remains welcoming and inclusive.

Go ahead and replace the text above (and this line!) with your
pull request description.

  • Pull request has descriptive title
  • Pull request gives overview of changes
  • New code has inline comments where necessary
  • Any new modules, functions or classes have docstrings consistent with dbprocessing style
  • Major new functionality has appropriate Sphinx documentation
  • Added an entry to release notes if fixing a major bug or providing a major new feature
  • New features and bug fixes should have unit tests
  • Relevant issues are linked in the description (use Closes # if this PR closes the issue, or some other reference, such as See # if it is related in some other way)

add posgresql dialect and fix unit testings. Some failure in testing are due to the other of files.

@jtniehof
Copy link
Member

jtniehof commented May 4, 2021

I've rebased around the merges and force-pushed to this PR. I kept the original branch at https://github.com/jtniehof/dbprocessing/tree/postgresql-original for reference. I checked the diffs of every commit in the new branch and compared to the original and I think I'm capturing it properly.

I'm going to go ahead and comment on this, and if we agree on changes I'll probably rebase them in to keep the history reasonably clear.

Copy link
Member

@jtniehof jtniehof left a comment

Choose a reason for hiding this comment

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

Lots of comments throughout...just reply on each and we'll figure out the approach, then do more updating/rebasing.

As far as I can tell, all the addFromConfig edits should be reverted in the end.

dbprocessing/DButils.py Show resolved Hide resolved
dbprocessing/DButils.py Outdated Show resolved Hide resolved
dbprocessing/DButils.py Outdated Show resolved Hide resolved
dbprocessing/DButils.py Show resolved Hide resolved
dbprocessing/DButils.py Show resolved Hide resolved
unit_tests/dbp_testing.py Outdated Show resolved Hide resolved
unit_tests/test_dbprocessing.py Outdated Show resolved Hide resolved
unit_tests/test_dbprocessing.py Outdated Show resolved Hide resolved
unit_tests/test_dbprocessing.py Outdated Show resolved Hide resolved
unit_tests/test_dbprocessing.py Outdated Show resolved Hide resolved
dnadeau-lanl and others added 3 commits May 20, 2021 16:21
 * Not tested in the sense that DButils isn't unit tested for postgres,
   but test added that will catch this when all unit tests run against
   postgres
 * Simply trying and catching doesn't work, because leaves the DB in a
   state that needs to be rolled back
Copy link
Member

@jtniehof jtniehof left a comment

Choose a reason for hiding this comment

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

Massively rebased and all the checks still pass (phew.) I have two open questions in the specific comments. Once I have feedback on those I can do one more rebase and we can merge.

Please do look over the current diff though and see if it all makes sense to you--my fingerprints are all over this now so I'd appreciate having another set of eyes, particularly making sure it's still fit for your purpose.

scripts/addFromConfig.py Outdated Show resolved Hide resolved
scripts/configFromDB.py Show resolved Hide resolved
unit_tests/data/configs/testDB.conf Outdated Show resolved Hide resolved
unit_tests/data/configs/testDB_extraKey.conf Outdated Show resolved Hide resolved
unit_tests/test_Utils.py Outdated Show resolved Hide resolved
@jtniehof
Copy link
Member

I should warn you that, at this point, if you run the unit tests and PGDATABASE is set, it WILL wipe out your database in the teardown! I'm thinking it might be worth adding a check to the setUp that the database is really empty (probably just a quick check that there's no mission defined yet.) That way if you forget and run the unit tests on a machine with a connection to an operational db you won't be hosed.

@dnadeau-lanl
Copy link
Contributor Author

dnadeau-lanl commented May 20, 2021

That's a good idea. Right now I am sourcing a file with "UNH" to set the testing table. I am always running dbprocessing "unit_test" in a "devel" machine, so that machine does not have access to the "real" database.

But I would like the safety, since things happen! 😏

@jtniehof
Copy link
Member

I'll do another rebase tomorrow morning and include the safety checking...then should be good to merge if it all looks good to you.

@jtniehof
Copy link
Member

Okay, rebase done, including the safety check. Take a look and post if you're happy, and then I'll do the approve and merge.

@dnadeau-lanl
Copy link
Contributor Author

This looks amazing! 🎉 🎆
I think we are ready to merge this. I will start using it here.

Thanks for all that work!

Copy link
Member

@jtniehof jtniehof left a comment

Choose a reason for hiding this comment

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

Okay, good to go after the back-and-forth.

@jtniehof jtniehof merged commit 5c0082c into spacepy:master May 25, 2021
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