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

Fix for sqlalchemy 2 and text upgrades #3267

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pjaol
Copy link

@pjaol pjaol commented Dec 20, 2023

Description

Quick fix for task history logging and sqlalchemy 2.x

Motivation and Context

Using sqlalchemy 2.x breaks luigid if task history is enabled
e.g.

[task_history]
db_connection = sqlite:///./log/luigi-task-hist.sqlite

Results in luigid exiting

File ".../env/lib/python3.11/site-packages/luigi/db_task_history.py", line 271, in _upgrade_schema
    for i in conn.execute('PRAGMA table_info(task_parameters);').fetchall():
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../env/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1414, in execute
    raise exc.ObjectNotExecutableError(statement) from err
sqlalchemy.exc.ObjectNotExecutableError: Not an executable object: 'PRAGMA table_info(task_parameters);'

This is because sqlalchemy requires a sqlalchemy.text object vs string in conn.execute

Have you tested this? If so, how?

Tested locally with sqlite3 and sqlalchemy 2.0.23 and luigi 3.4.0

@pjaol pjaol requested review from dlstadther and a team as code owners December 20, 2023 22:53
tox.ini Outdated Show resolved Hide resolved
@pjaol
Copy link
Author

pjaol commented Jan 15, 2024

Hey @dlstadther what can I do to help move this forward?
I'm not sure what to look at to increase the code cov test

@metazool
Copy link

metazool commented Nov 20, 2024

Just encountered this issue and was considering making a similar set of changes, glad I didn't!

Tried running the tests locally with tox as suggested in CONTRIBUTING.rst and there are some changes in tox 4 which would need reflecting here as well - the pass_env syntax changes as shown here, and tox -e py3X-core test/example.py etc needs a -- before non-tox options now

For now our project can pin an older version of sqlalchemy but it would be lovely to see this PR progress, does your user base have much to lose by dropping python 3.6 support in order to gain sqlalchemy 2.X? It's been end-of-life for a while...

@dlstadther
Copy link
Collaborator

Looking at https://pypistats.org/packages/luigi , there is virtually no 3.6 usage of luigi.
I'd be fine removing the support for 3.6, but would require a major version incremental of the project. So recent outstanding PRs would need to be merged and released first.

@dlstadther
Copy link
Collaborator

Looking back at past releases, we haven't performed a major version increment when dropping a specific minor version of python.

@dlstadther
Copy link
Collaborator

FYI. I've submitted #3325

@metazool
Copy link

metazool commented Dec 2, 2024

FYI. I've submitted #3325

That's very reassuring to see, thank you

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.

3 participants