Add _escape_trino, keep _escape_presto as a backward-compatible alias - #747
Merged
Conversation
Athena's engine is Trino (engine v3; Presto in engine v1/v2). Rename the quote-doubling escaper to _escape_trino, the canonical name, and keep _escape_presto as a thin alias that delegates to it so external callers importing it (e.g. dbt-athena) keep working. _get_escaper() now returns _escape_trino. Trino and Presto escape string literals identically -- a single quote is doubled and a backslash is not an escape character -- so this is a naming change with no behavior change. Closes #746 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHAT
Introduce
_escape_trinoas the canonical quote-doubling escaper inpyathena/formatter.py, and make_escape_prestoa thin backward-compatible alias that delegates to it._get_escaper()now returns_escape_trino. Adds direct unit tests for both. No behavior change.WHY
Athena's query engine is Trino (engine version 3; Presto in engine v1/v2), so
_escape_trinois the accurate name._escape_prestois underscore-prefixed (private) but external tooling such as dbt-athena may import it, so it is kept as a deprecated alias rather than renamed outright, to avoid breaking callers.Trino and Presto escape string literals identically — a single quote is escaped by doubling it (
'') and a backslash is not an escape character inside an ordinary single-quoted literal (both follow ANSI SQL; backslash-escaping is the Hive/MySQL convention, which is why_escape_hiveis separate). The alias is therefore behavior-preserving.References:
Closes #746