|
1 |
| -{% macro get_tables_by_prefix_sql(schema, prefix, exclude='') %} |
| 1 | +{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %} |
2 | 2 | {{ adapter_macro('dbt_utils.get_tables_by_prefix_sql', schema, prefix, exclude) }}
|
3 | 3 | {% endmacro %}
|
4 | 4 |
|
5 |
| -{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='') %} |
| 5 | +{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %} |
6 | 6 |
|
7 | 7 | select distinct
|
8 |
| - table_schema || '.' || table_name as ref |
9 |
| - from information_schema.tables |
| 8 | + table_schema as "table_schema", table_name as "table_name" |
| 9 | + from {{database}}.information_schema.tables |
10 | 10 | where table_schema = '{{ schema }}'
|
11 | 11 | and table_name ilike '{{ prefix }}%'
|
12 | 12 | and table_name not ilike '{{ exclude }}'
|
13 | 13 |
|
14 | 14 | {% endmacro %}
|
15 | 15 |
|
16 | 16 |
|
17 |
| -{% macro bigquery__get_tables_by_prefix_sql(schema, prefix, exclude='') %} |
| 17 | +{% macro bigquery__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %} |
18 | 18 |
|
19 | 19 | select distinct
|
20 |
| - concat(dataset_id, '.', table_id) as ref |
| 20 | + dataset_id as table_schema, table_id as table_name |
21 | 21 |
|
22 |
| - from {{schema}}.__TABLES_SUMMARY__ |
| 22 | + from {{adapter.quote(database)}}.{{schema}}.__TABLES_SUMMARY__ |
23 | 23 | where dataset_id = '{{schema}}'
|
24 | 24 | and lower(table_id) like lower ('{{prefix}}%')
|
25 | 25 | and lower(table_id) not like lower ('{{exclude}}')
|
|
0 commit comments