I am getting below error due to exceeding max limit of 10000 inside adapters.sql
Too many columns in relation {{ relation }}! dbt can only get
information about relations with fewer than {{ maximum }} columns.
Can I edit the below code of adapters.sql and increase size from 10000 to 12000. This file gets created/configured when we run “pip install dbt-snowflake” during the setup.
{% set maximum = 10000 %}
{% if (result | length) >= maximum %}
{% set msg %}
Too many columns in relation {{ relation }}! dbt can only get
information about relations with fewer than {{ maximum }} columns.
{% endset %}
{% do exceptions.raise_compiler_error(msg) %}
{% endif %}
You can try creating a macro inside a .SQL file in your project with the same name, then you just alter the maximum.
Your macro in your project is supposed to override the one defined in dbt-snowflake, and then you don’t have any problem if you have to re-install the package.
Also, I don’t know why the maximum is set to 10000 and I don’t know the consequences of changing it to 12000. The fact is that you can do it if you want.
{% macro snowflake__get_columns_in_relation(relation) -%}
{%- set sql -%}
describe table {{ relation }}
{%- endset -%}
{%- set result = run_query(sql) -%}
{% set maximum = 12000 %}
{% if (result | length) >= maximum %}
{% set msg %}
Too many columns in relation {{ relation }}! dbt can only get
information about relations with fewer than {{ maximum }} columns.
{% endset %}
{% do exceptions.raise_compiler_error(msg) %}
{% endif %}
{% set columns = [] %}
{% for row in result %}
{% do columns.append(api.Column.from_description(row['name'], row['type'])) %}
{% endfor %}
{% do return(columns) %}
{% endmacro %}
One more thing, if you are overriding adapters macros, it is good to whenever you update your dbt version, check if there was some breaking changes in the macro you are overriding. Then consider applying the same changes to your custom macro to avoid any issues.