Skip to content

Add _escape_trino, keep _escape_presto as a backward-compatible alias - #747

Merged
laughingman7743 merged 1 commit into
masterfrom
refactor/escape-trino-alias
Jul 31, 2026
Merged

Add _escape_trino, keep _escape_presto as a backward-compatible alias#747
laughingman7743 merged 1 commit into
masterfrom
refactor/escape-trino-alias

Conversation

@laughingman7743

Copy link
Copy Markdown
Member

WHAT

Introduce _escape_trino as the canonical quote-doubling escaper in pyathena/formatter.py, and make _escape_presto a 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_trino is the accurate name. _escape_presto is 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_hive is separate). The alias is therefore behavior-preserving.

References:

Closes #746

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>
@laughingman7743
laughingman7743 marked this pull request as ready for review July 31, 2026 14:02
@laughingman7743
laughingman7743 merged commit ce8feb7 into master Jul 31, 2026
15 checks passed
@laughingman7743
laughingman7743 deleted the refactor/escape-trino-alias branch July 31, 2026 14:02
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.

Add _escape_trino and alias _escape_presto to it (terminology consistency)

1 participant