Conversation
- Ran ruff format on all repository files - Ran ruff check --fix & and fixed B006, B007, B018, B904 e
253fe2d to
2d1e70c
Compare
Install `freetds-dev` (and build-essentials) so `pymssql` can compile against the FreeTDS headers.
268ffe9 to
33b0e82
Compare
|
Having some troubles with the tests for python 3.7 =/ now that |
| discriminator_column = model.__mapper_args__["polymorphic_on"] | ||
| if isinstance(discriminator_column, str): | ||
| args["polymorphic_on"] = discriminator_column | ||
| elif isinstance(discriminator_column, MappedColumn): | ||
| args["polymorphic_on"] = discriminator_column.column.key | ||
| else: | ||
| args["polymorphic_on"] = column.key | ||
| args["polymorphic_on"] = discriminator_column.key |
There was a problem hiding this comment.
This is really helpful @lukasab, Is it ok if i moved the mappedcolumn fix to separate commit from the ruff-pre-commit change?
There was a problem hiding this comment.
Of course, this being released would help me out as I'm trying to migrate to the new MappedColumn
| unfixable = [] | ||
|
|
||
| # Allow unused variables when underscore-prefixed. | ||
| dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" |
There was a problem hiding this comment.
some values here are the default ruff values, we can skip those and specify only the update values?
looks like we only the updated the select config
There was a problem hiding this comment.
Sure, I can remove the default values.
I was wondering which selects to use on the [tool.ruff.lint] section, but unsure who was maintaining the repo here to ask
| python-version: | ||
| - "3.7" | ||
| - "3.12" | ||
| - "3.7.17" |
There was a problem hiding this comment.
trying to understand why it was needed to fix to specific version?
There was a problem hiding this comment.
Seems to be breaking because of the ubuntu os update required
test failed with:
The version '3.7' with architecture 'x64' was not found for Ubuntu 24.04. The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
|
Is it planned to still support python 3.7 and 3.8? I believe sqlalchemy 2.x is supporting <=3.9 |
hmm, says otherwise here and in pypi not sure if this is just documentation error? |
|
I'll close this PR as you have opened a new one with the fixes. Thank you! |
What does this PR do?
Fixes
AttributeError: 'MappedColumn' object has no attribute 'key'on SQLAlchemy ≥ 2.0Code-quality pass with Ruff
ruff format .for consistent modern formatting.ruff check/flake8(unused imports, spacing, etc.). No behavioural changes outside the bug
fix above.
Motivation
Polymorphic, versioned models crash on SQLAlchemy 2.x because
MappedColumnno longer exposes a top-level.key.This PR resolves issue #149 and restores compatibility.