Skip to content

fix(athena): escape single quotes in iceberg DDL splices#3372

Merged
kukushking merged 2 commits into
mainfrom
fix/athena-iceberg-ddl-escape
Jun 17, 2026
Merged

fix(athena): escape single quotes in iceberg DDL splices#3372
kukushking merged 2 commits into
mainfrom
fix/athena-iceberg-ddl-escape

Conversation

@kukushking

Copy link
Copy Markdown
Collaborator

Feature or Bugfix

  • Bugfix

Detail

  • Escape single quotes in columns_comments values and additional_table_properties keys/values when interpolated into the generated CREATE TABLE DDL in _create_iceberg_table. Caller-supplied content stays inside the surrounding string literal and cannot append clauses (LOCATION, TBLPROPERTIES, ...).
  • Add unit test in tests/unit/test_moto.py exercising both splice sites.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

`_create_iceberg_table` interpolates `columns_comments` values and
`additional_table_properties` keys/values into a generated CREATE TABLE
DDL with no escaping. A value containing a single quote can close the
surrounding string literal and append additional clauses (LOCATION,
TBLPROPERTIES, etc.).

Add `_escape_athena_string_literal` that doubles single quotes per the
Athena/Trino string-literal escape rule, and apply it at both splice
sites. Both keys and values in `additional_table_properties` are
escaped for symmetry — the cost is one function call.

Add a unit test in `test_moto.py` that exercises both splice sites with
a representative payload and asserts the structure of the generated DDL
is preserved.
@kukushking kukushking self-assigned this Jun 17, 2026
@kukushking kukushking merged commit 6640a06 into main Jun 17, 2026
30 checks passed
@kukushking kukushking deleted the fix/athena-iceberg-ddl-escape branch June 17, 2026 17:42
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.

2 participants