Skip to content

Add transpilation support for DECRYPT_RAW and TRY_DECRYPT_RAW#7475

Open
fivetran-ashashankar wants to merge 1 commit intomainfrom
RD-1069382-transpile-decrypt_raw
Open

Add transpilation support for DECRYPT_RAW and TRY_DECRYPT_RAW#7475
fivetran-ashashankar wants to merge 1 commit intomainfrom
RD-1069382-transpile-decrypt_raw

Conversation

@fivetran-ashashankar
Copy link
Copy Markdown
Collaborator

This PR adds transpilation support for Snowflake's DECRYPT_RAW and TRY_DECRYPT_RAW functions to DuckDB.

Changes

  • Added decryptraw_sql method in sqlglot/generators/duckdb.py that handles both DECRYPT_RAW and TRY_DECRYPT_RAW using the safe flag
  • Both functions are marked as unsupported in DuckDB with appropriate warning messages
  • Uses function_fallback_sql to generate the SQL output
  • Added test cases for both functions in integration tests

Implementation

The method checks the safe flag on the expression to determine whether to output DECRYPT_RAW or TRY_DECRYPT_RAW, similar to the DECRYPT/TRY_DECRYPT implementation.

Related: RD-1069382

@fivetran-ashashankar fivetran-ashashankar force-pushed the RD-1069382-transpile-decrypt_raw branch from ddf9890 to dd2f0cf Compare April 8, 2026 23:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

SQLGlot Integration Test Results

Comparing:

  • this branch (sqlglot:RD-1069382-transpile-decrypt_raw, sqlglot version: RD-1069382-transpile-decrypt_raw)
  • baseline (main, sqlglot version: 0.0.1.dev1)

By Dialect

dialect main sqlglot:RD-1069382-transpile-decrypt_raw transitions links
bigquery -> bigquery 22925/22930 passed (100.0%) 21255/21255 passed (100.0%) No change full result / delta
bigquery -> duckdb 1304/1674 passed (77.9%) 0/0 passed (0.0%) Results not found full result / delta
snowflake -> duckdb 1521/2678 passed (56.8%) 0/0 passed (0.0%) Results not found full result / delta
snowflake -> snowflake 65927/65927 passed (100.0%) 63028/63028 passed (100.0%) No change full result / delta
databricks -> databricks 1370/1370 passed (100.0%) 1370/1370 passed (100.0%) No change full result / delta
postgres -> postgres 6042/6042 passed (100.0%) 6042/6042 passed (100.0%) No change full result / delta
redshift -> redshift 7101/7101 passed (100.0%) 7101/7101 passed (100.0%) No change full result / delta

Overall

main: 107722 total, 106190 passed (pass rate: 98.6%), sqlglot version: 0.0.1.dev1

sqlglot:RD-1069382-transpile-decrypt_raw: 98796 total, 98796 passed (pass rate: 100.0%), sqlglot version: RD-1069382-transpile-decrypt_raw

Transitions:
No change

Dialect pair changes: 0 previous results not found, 2 curent results not found

✅ 18 test(s) passed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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