Add support for macro get_tables_by_pattern_sql
In order to be used by other package like dbt-codegen,
it would be nice to provide implementation using this adapters for some macros like get_tables_by_pattern_sql.
Happy to help in implementation as the difference is mostly to directly use information_schema view directly
Do you have a list of the affected macros? I've got no experience with dbt-codegen -- how hard would it be to validate against the ClickHouse adapter? Can we just run the existing tests in that project?
Feel free to submit a pull request if you have created a working implementation.
@genzgd that functionality is in dbt-utils package mostly.
the adapter related macros that should be overridden:
{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}
select distinct
table_schema as {{ adapter.quote('table_schema') }},
table_name as {{ adapter.quote('table_name') }},
{{ dbt_utils.get_table_types_sql() }}
from {{ database }}.information_schema.tables
where table_schema ilike '{{ schema_pattern }}'
and table_name ilike '{{ table_pattern }}'
and table_name not ilike '{{ exclude }}'
{% endmacro %}
But I think it should be done in that project, or locally, not here, since this project doesn't declare dbt-utils as a dependency
The dbt-utils package is deprecated and that functionality is being migrated to the core, so it makes sense to override it in dbt-clickhouse. So far we've been implementing ClickHouse specific versions of macros as the dbt team migrates them to dbt-core (and most importantly, adds the appropriate tests.). We can accelerate that process if there is a detailed request (or better yet a pull request), but we aren't currently prioritizing that work.