Repository navigation
v3.38.0
·
1556 commits
to master
since this release
v3.38.0 is a minor release of the 3.x maintenance line. It backports bug fixes from master (#1104, #903) and contains no breaking changes. The 3.x line still supports Python 3.10 and sqlalchemy>=1.0.0, and its dependency requirements are unchanged.
It includes the fixes for the issues @aminghadersohi reported, #854 and #857, as well as @aminghadersohi's own fix #839. Thank you for the reports and the contribution.
SQLAlchemy
- Reflected top-level
map<...>columns areAthenaMap(key_type, value_type)instead ofString. Top-levelstruct<...>/row(...)columns areAthenaStructwith their field types (#995, #857). A field, key, or value type that the dialect does not recognize is reflected asNullTypewith a warning. - A bare
awsathena://URL resolves to the REST dialect, the same asawsathena+rest://. Before,engine.driverraisedAttributeError(#839). to_sqlfinds an existing table whatever the case of its name (#800, #799).
Cursors
TIMESTAMP WITH TIME ZONEvalues with a numeric UTC offset such as+05:30convert to aware datetimes with a fixed offset instead of naive ones (#1033, #854). Values with a zone name are unchanged.- A synchronous
forloop over an asyncio cursor or result set raisesTypeErrorinstead of never ending. Useasync for(#899, #898). - The client-side result cache (
cache_size/cache_expiration_time) is no longer used forqmarkqueries with parameters. Before, it could return the result of an execution that ran with different parameters, because Athena does not return the parameters of earlier executions. A repeated qmark query with the same parameters is now executed again (#959, #941). - PandasCursor (#950, #924):
- Without
chunksize,as_pandas()returns the whole result whenauto_optimize_chunksizechose a chunk size. It used to return only the first chunk. - A second
as_pandas()call, or one made after rows were fetched, returns an empty DataFrame instead of raisingStopIteration. PandasDataFrameIterator.as_pandas(), as returned byiter_chunks()or byas_pandas()with an explicitchunksize, keeps the chunks' index and categorical dtypes. Withindex_col, the joined DataFrame is indexed by that column instead of a newRangeIndex.
- Without
- With
engine="pyarrow", PandasCursor reads the tab-separated.txtresults of DDL statements such asSHOW TABLESandDESCRIBEwith the C engine, keeping leading zeros, exponent notation, and padding (#1075, #1073). - ArrowCursor:
- ArrowCursor with managed query result storage (no output location): the fetch methods return the values that
as_arrow()holds. TIME, VARBINARY, and JSON values used to raiseTypeErrorbecause the values were converted twice. A custom Arrow converter mapping is therefore not applied on this path, the same as foras_arrow()(#1023, #1021). - A closed
PolarsDataFrameIteratorstops for every reader kind (#1029, #1019).
Spark
- Session readiness polling stops with
OperationalErrorwhen the session is terminated, degraded, or failed, instead of polling forever (#831, #792). - A Spark session that a cursor starts is terminated when the cursor setup fails (#832, #794).
AsyncSparkCursor.close()shuts down its executor even when session termination fails (#830, #795).
S3 filesystem
- Appending to an object keeps its existing data. This fixes data loss when appending within a larger block size, truncation by an empty append, and duplicated bytes (#929, #921).
- A single large
write()no longer makes the multipart upload fail withEntityTooSmall(#947, #942). - Multipart copies, including appends to objects over 5 GiB, keep their parts within the S3 part size limits (#955, #951).
- With a short last part, the multipart part boundaries change, so the multipart ETag of identical content can differ from before (#947, #955).
- Stale listing and object caches are invalidated (#928, #922).
Development
- The Test workflow runs the SQLAlchemy and Spark suites when shared core modules change, and the PyAthena suite only when its files change (#906, #913). The compliance-suite dialect registry matches the entry points (#905). Cache-hit tests run in the test work group (#817).
What's Changed
- Backport #839: Resolve the bare awsathena scheme to the REST dialect by @laughingman7743 in #903, which backports:
- Resolve the bare awsathena scheme to the REST dialect by @aminghadersohi in #839
- Align the compliance-suite dialect registry with the entry points by @laughingman7743 in #905
- Backport #906: Run SQLAlchemy and Spark tests when shared core modules change by @laughingman7743 in #910
- Backport #913: Run the PyAthena suite only when its files change by @laughingman7743 in #915
- Backport bug fixes to 3.x for v3.38.0 by @laughingman7743 in #1104, which backports these master pull requests:
- Find an existing table in to_sql whatever the name's case by @laughingman7743 in #800
- Assert cache hits in the test work group instead of primary by @laughingman7743 in #817
- Stop Spark session readiness polling on failure states by @laughingman7743 in #831
- Shut down the AsyncSparkCursor executor when session termination fails by @laughingman7743 in #830
- Terminate a newly started Spark session when cursor setup fails by @laughingman7743 in #832
- Reject synchronous iteration of the asyncio cursors and result sets by @laughingman7743 in #899
- Map Arrow decimal32/64/256 to Athena decimal (decimal256 only on 3.x) by @laughingman7743 in #900
- Fix stale S3FileSystem listing and object caches by @laughingman7743 in #928
- Keep the existing object when appending within a larger block size by @laughingman7743 in #929
- Merge a short trailing block into the previous multipart part by @laughingman7743 in #947
- Keep multipart copy parts within the S3 part size limits by @laughingman7743 in #955
- Skip the result cache for qmark queries with parameters by @laughingman7743 in #959
- Return the whole result from as_pandas() when auto chunking applies by @laughingman7743 in #950
- Reflect the field and value types of top-level STRUCT and MAP columns by @laughingman7743 in #995
- Do not convert ArrowCursor fallback values twice by @laughingman7743 in #1023
- Stop a closed PolarsDataFrameIterator for every reader kind by @laughingman7743 in #1029
- Keep NULL rows of single-column CSV results in ArrowCursor by @laughingman7743 in #1031
- Convert time zone values to aware times and empty TIME/JSON text to NULL (#854 part only on 3.x) by @laughingman7743 in #1033
- Read multi-line CSV values that cross a block in ArrowCursor by @laughingman7743 in #1045
- Use the C engine for Pandas DDL text results by @laughingman7743 in #1075
New Contributors
- @aminghadersohi made their first contribution in #839
Full Changelog: v3.37.0...v3.38.0