Repository navigation
Require SQLAlchemy 2.0.52 (GH-1574) #1600
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
Changes from all commits
c4430ad
096febb
ffbabb7
eab1e07
171daf1
06fcc37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,9 +73,9 @@ awsathena = "pyathena.sqlalchemy.rest:AthenaRestDialect" | |
| "awsathena.aios3fs" = "pyathena.aio.sqlalchemy.s3fs:AthenaAioS3FSDialect" | ||
|
|
||
| [project.optional-dependencies] | ||
| sqlalchemy = ["sqlalchemy>=2.0.44"] | ||
| sqlalchemy = ["sqlalchemy>=2.0.52"] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round two (claims, compatibility, evidence): CLEAN Base
|
||
| aiosqlalchemy = [ | ||
| "sqlalchemy[asyncio]>=2.0.44", | ||
| "sqlalchemy[asyncio]>=2.0.52", | ||
| ] | ||
| pandas = [ | ||
| "pandas>=3.0.0", | ||
|
|
@@ -89,7 +89,7 @@ polars = [ | |
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "sqlalchemy[asyncio]>=2.0.44", | ||
| "sqlalchemy[asyncio]>=2.0.52", | ||
| "pandas>=3.0.0", | ||
| "pyarrow>=22.0.0", | ||
| "polars>=1.39.0", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
|
|
||
| import numpy as np | ||
| import pytest | ||
| from sqlalchemy import cast, column, literal, select, types | ||
| from sqlalchemy import cast, column, exc, literal, select, types | ||
|
|
||
| from pyathena.sqlalchemy.rest import AthenaRestDialect | ||
| from pyathena.sqlalchemy.types import AthenaArray | ||
|
|
@@ -134,21 +134,15 @@ def test_result(self, type_, expected): | |
|
|
||
|
|
||
| @pytest.mark.parametrize("type_", [types.Numeric(10, 2), types.Float()]) | ||
| def test_other_literal_values_render_as_sqlalchemy(type_): | ||
| # A value that is neither a Decimal nor a real number takes SQLAlchemy's own | ||
| # literal processor, which checks that the value is a number in 2.0.52 and | ||
| # later. | ||
| dialect = AthenaRestDialect() | ||
| value = "1 OR 1=1" | ||
|
|
||
| def outcome(processor): | ||
| try: | ||
| return processor(value) | ||
| except Exception as e: | ||
| return type(e) | ||
|
|
||
| adapted = type_.dialect_impl(dialect).literal_processor(dialect) | ||
| assert outcome(adapted) == outcome(type_.literal_processor(dialect)) | ||
| @pytest.mark.parametrize( | ||
| ("literal_execute", "compile_kwargs"), | ||
| [(False, {"literal_binds": True}), (True, {"render_postcompile": True})], | ||
| ) | ||
| def test_non_numeric_literal_raises(type_, literal_execute, compile_kwargs): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Self-review round one (implementation behavior): FINDINGS, repaired Base Repaired:
Rejected:
|
||
| # SQLAlchemy's own literal processor checks that the value is a number. | ||
| expression = literal("1 OR 1=1", type_, literal_execute=literal_execute) | ||
| with pytest.raises(exc.CompileError): | ||
| _literal_sql(expression, compile_kwargs) | ||
|
|
||
|
|
||
| class TestAthenaFloat: | ||
|
|
||
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.
Independent review (Codex
codex exec -s read-only, static review plus offline Python; no AWS): base0efea77f0bd43cdcba169414427c639b2e6bd15e..eab1e07f(session01a22c3e-ccae-7372-a007-2bf3a789f547). Codex confirmed the floor in every place it is stated, the lock (uv lock --checkpasses, and the 10 reverted marker rewrites are equivalent), 580 offline PyAthena tests passing on 2.0.52, 2.0.58 and 2.1.9, and theTrueDivTestoverride (both parameter axes kept, 4 of 10 combinations skipped, the guard keeps the inherited tests before 2.0.55). Findings:CompileError, butliteral_executeraisesStatementErrorwithorigCompileErrorat execution. Fixed in171daf16. The test stays at compile time; the wrapping at execution is SQLAlchemy's generic behavior."1.250"renders. Fixed in171daf16and06fcc379(the rule is now "decimal.Decimal(value)raises").idswith[4, 5]vsids_1). Rejected: an upstream bug for every dialect; the floor follows what PyAthena's own contracts need (Require SQLAlchemy 2.0.52 and check the values of Float and binary literals #1574 decision).DeprecatedCompoundSelectTest). Pre-existing; fixed by Decode float ARRAY elements and import the compliance suite on SQLAlchemy 2.1 (GH-1569) #1577.eab1e07f..171daf16, session01a22c4d-2cf7-7a71-8049-61fc7aef9604): two qualifications,Noneand the decimal context. The rule was restated as "Decimal(value)raises".171daf16..f4b8274c, session01a22c51-cc18-7582-af22-0ee650f99f83): the added "Noneis written asNULL" does not hold forevaluates_none()types. The sentence was removed in06fcc379180b04237e8edabec2ae745dbd1d51b3; such aNoneis rejected under the stated rule.Snapshot and PR worktrees were clean after each run.