Update get_tables_by_pattern_sql.sql #563
Closed
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.
Create specific athena macro because ilike is not a valid function
This is a:
next/patch
next/minor
next/major
Description & motivation
When I trying to use dbt codegen to generate source yaml's, I get a query error:
dbt run-operation generate_source --args '{"schema_name": "ktech_datalake_raw", "table_pattern": "course_course"}' 16:17:53 Running with dbt=1.0.5 Failed to execute query. Traceback (most recent call last): File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pyathena/common.py", line 307, in _execute query_id = retry_api_call( File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/pyathena/util.py", line 84, in retry_api_call return retry(func, *args, **kwargs) File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tenacity/__init__.py", line 423, in __call__ do = self.iter(retry_state=retry_state) File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tenacity/__init__.py", line 360, in iter return fut.result() File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/concurrent/futures/_base.py", line 432, in result return self.__get_result() File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result raise self._exception File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/tenacity/__init__.py", line 426, in __call__ result = fn(*args, **kwargs) File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/botocore/client.py", line 388, in _api_call return self._make_api_call(operation_name, kwargs) File "/Users/silvio/.pyenv/versions/3.8.6/lib/python3.8/site-packages/botocore/client.py", line 708, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 18:28: mismatched input 'ilike'. Expecting: '%', '*', '+', '-', '.', '/', 'AT', '[', '||', <expression> Failed to execute query.
This errors happens because the macro get_tables_by_pattern_sql uses like function (not supported on Athena)
Checklist
star()
source)limit_zero()
macro in place of the literal string:limit 0
dbt_utils.type_*
macros instead of explicit datatypes (e.g.dbt_utils.type_timestamp()
instead ofTIMESTAMP