Skip to content

Fix python 3.9 and sqlalchemy 1.4 deprecations#120

Merged
dnadeau-lanl merged 2 commits intospacepy:masterfrom
jtniehof:deprecations
Feb 4, 2022
Merged

Fix python 3.9 and sqlalchemy 1.4 deprecations#120
dnadeau-lanl merged 2 commits intospacepy:masterfrom
jtniehof:deprecations

Conversation

@jtniehof
Copy link
Member

@jtniehof jtniehof commented Feb 3, 2022

This PR fixes deprecations for Python 3.9 (some of which would be errors in 3.10) and for sqlalchemy 1.4. Maintains support on earlier Python and sqlalchemy. Closes #83.

For Python 3.9/3.10:

  • imports abstract base classes from collections.abc if possible (fallback to collections)
  • Replaces is string comparisons with ==
  • A little bit of style cleanup in directly-related lines

For sqlalchemy 1.4:

  • table_names() was removed (affects tests only)
  • mapped_table was replaced with persist_selectable (affects tests only)
  • Make a subquery into an explicit selection (DButils)
  • Make a subquery into an explicitly scalar subquery (newestVersionProblemFinder, which is untested)

This supersedes #84, which does not fix all warnings in #83 and didn't preserve namespacing on collections.

PR Checklist

  • Pull request has descriptive title
  • Pull request gives overview of changes
  • New code has inline comments where necessary
  • (N/A) Any new modules, functions or classes have docstrings consistent with dbprocessing style
  • (N/A) Major new functionality has appropriate Sphinx documentation
  • (N/A) Added an entry to release notes if fixing a major bug or providing a major new feature
  • (see below) 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)

We don't yet have unit tests to make sure warnings aren't raised, and I didn't add them. But the tests now pass without warnings on Python 3.10 and sqlalchemy 1.4.

 * ABCs from collections (spacepy#83)
 * 'is' comparisons to string
 * table_names() removed (test only)
 * mapped_table replaced with persist_selectable (test only)
 * make subquery select explicit (DButils)
 * make scalar subquery explicity (newestVersionProblemFinder)
Copy link
Contributor

@dnadeau-lanl dnadeau-lanl left a comment

Choose a reason for hiding this comment

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

Awesome 😄

@dnadeau-lanl dnadeau-lanl merged commit 0a0a744 into spacepy:master Feb 4, 2022
@jtniehof jtniehof deleted the deprecations branch February 4, 2022 20:05
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.

deprecations: collections.abc, Engine.table_name

2 participants