-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Make FTM cross-compatible with SQLAlchemy 1.4 and 2+ #1181
Conversation
setup.py
Outdated
@@ -40,7 +40,7 @@ | |||
"requests >= 2.21.0, < 3.0.0", | |||
"python-levenshtein >= 0.12.0, < 1.0.0", | |||
"normality >= 2.4.0, < 3.0.0", | |||
"sqlalchemy >= 1.2.0, < 3.0.0", | |||
"sqlalchemy >= 1.3.2, < 3.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.
Shouldn’t this require at least 1.4 (which is the first version that supports the 2.0 API)?
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 didn't increase it yet to 1.4
because I still have the lingering issue of tests in dataset
failing for SQLAlchemy
version 1.4.49
. Not knowing the reason behind it yet, I didn't want to break these libs for anyone using them in a way that triggers this issue.
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.
Leaving it at >= 1.3.2
can cause runtime errors though:
pip install "SQLAlchemy==1.3.2" "git+https://github.com/alephdata/followthemoney.git@chore/sqlalchemy-crosscompatibility"
ftm map mapping.yml
Traceback (most recent call last):
File "/Users/tillprochaska/git/ftm-sqa-test/venv/bin/ftm", line 33, in <module>
sys.exit(load_entry_point('followthemoney==3.5.1', 'console_scripts', 'ftm')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tillprochaska/git/ftm-sqa-test/venv/bin/ftm", line 25, in importlib_load_entry_point
return next(matches).load()
^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/tillprochaska/git/ftm-sqa-test/venv/lib/python3.11/site-packages/followthemoney/__init__.py", line 3, in <module>
from followthemoney.model import Model
File "/Users/tillprochaska/git/ftm-sqa-test/venv/lib/python3.11/site-packages/followthemoney/model.py", line 9, in <module>
from followthemoney.mapping import QueryMapping
File "/Users/tillprochaska/git/ftm-sqa-test/venv/lib/python3.11/site-packages/followthemoney/mapping/__init__.py", line 1, in <module>
from followthemoney.mapping.query import QueryMapping
File "/Users/tillprochaska/git/ftm-sqa-test/venv/lib/python3.11/site-packages/followthemoney/mapping/query.py", line 6, in <module>
from followthemoney.mapping.sql import SQLSource
File "/Users/tillprochaska/git/ftm-sqa-test/venv/lib/python3.11/site-packages/followthemoney/mapping/sql.py", line 7, in <module>
from sqlalchemy.future import select
ModuleNotFoundError: No module named 'sqlalchemy.future'
Whereas with SQLAlchemy >= 1.4, < 2
this works as expected. I don’t think this would affect us, as far as I can see the pipelines image for example already resolves SQLAlchemy to 1.4.x. So if you think it’s necessary to keep 1.3 go ahead, but it still feels a bit wrong publishing dependency constraints that could cause runtime errors.
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 updated the minimum SQLAlchemy
version. I think you're right, this might affect anyone running FTM on its own, or in conjuncture with other scripts. I re-build memorious
and it builds fine, I re-ran a memorious
test and it works.
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.
Is there a particular reason why the version constraints for normality
, banal
, click
had to change? I don’t mind the version bumps being included in this PR, I was just wondering about the reason behind it…
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 fixed click
, that was a mistake (not a terrible one, it current constraint just crapped click
below the latest version).
banal
and normality
are libs we created. I bumped the minimum version to the latest version. Both of these were giving me dependency clashes with memorious
.
sql.py
to work with SQLA 2+ (as per the docs) - current warning is: