How do I fill in the column’s data type in the generated dbt docs? I referred to this column_types | dbt Developer Hub but that’s only for seed file and doesn’t seem to work for models. I tried using CAST in the table’s transformation code but TYPE is still blank when I generate the docs afterwards…
dbt gets the type information by querying the model when the docs are generated. Was the model run before the docs were generated?
If so, I wonder if it could be that the adapter doesn’t support it, which warehouse are you on?
It is possible to set data types on columns for models, sources etc as well: columns | dbt Developer Hub
However as @jaypeedevlin said, you shouldn’t need to - dbt should check your database’s information_schema or equivalent. Have a look at your logs when you run
dbt docs generate - if dbt can’t access the information schema with the account it’s using, you may need to grant that user permissions, as shown by an error like this (Redshift example):
Warning: The database user “dbt_joel” has insufficient permissions to query the “svv_table_info” table. Please grant SELECT permissions on this table to the “dbt_joel” user to fetch extended table details from Redshift.