Skip to content

Update macro regexp_instr.sql for Athena support#32

Open
tom-orvn-al wants to merge 1 commit intometaplane:mainfrom
tom-orvn-al:patch-1
Open

Update macro regexp_instr.sql for Athena support#32
tom-orvn-al wants to merge 1 commit intometaplane:mainfrom
tom-orvn-al:patch-1

Conversation

@tom-orvn-al
Copy link

@tom-orvn-al tom-orvn-al commented Oct 2, 2025

Add Athena support to the regex macro 'expect_column_values_to_match_regex'

Summary of Changes

  • Added athena__regexp_instr macro implementation to support Athena/Trino databases
  • Implemented regex matching using Athena's native regexp_like function instead of unsupported regexp_instr
  • Added proper warning handling for unsupported is_raw and flags parameters on Athena
  • Maintains compatibility with existing test configurations while enabling Athena users to use regex validation tests

Why Do We Need These Changes

The dbt_expectations.expect_column_values_to_match_regex test currently fails on Athena/Trino databases with the error: FUNCTION_NOT_FOUND: Function 'regexp_instr' not registered

This is because Athena/Trino doesn't support the regexp_instr function used by the default implementation. This PR enables dbt-expectations users on Athena to perform regex validation on their data quality tests, which is essential for validating formats like email addresses, phone numbers, and other pattern-based data.

Testing

  • Tested with email regex validation: '^.+@.+\..+$'
  • Verified backward compatibility with other database adapters
  • Confirmed proper handling of unsupported parameters (is_raw, flags)

Reviewers

@tpoll @gusvargas

Add athena support to the regex macro 'expect_column_values_to_match_regex'
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