datacoves/dbt-coves

[BUG] dbt-coves fails to detect columns in schema

Closed this issue · 8 comments

Describe the bug
A clear and concise description of what the bug is.

For a single schema, dbt-coves is unable to detect columns via generate sources, producing the following SQL:

SELECT
FROM {{ source('xyz', 'abc') }}

and YML:

- name: xyz__abc
    description: ''
    columns:

but for all other schemas, dbt-coves correctly generates sources. I'm unable to figure out why this is the case. Some debugging suggestions would be appreciated.

noel commented

Which database are you using?

can you post the table DDL?

Hi @noel— using redshift. I've been unable to determine what's different about these tables. The columns are a mix of VARCHAR, INT, GEOMETRY, and DATE columns.

I've used dbt-coves successfully with similar tables, so I'm not entirely sure where to start here ☹️

noel commented

Do you have other tables that work with a Geometry data type?

@noel Yes, I can confirm I've used dbt-coves for those. The issue only seems to occur on a single schema.

@noel Fixed! I think I needed to explicitly grant update permissions to the Redshift user creating the models. This wasn't an issue for other schemas, since this redshift user owned the other tables.

It might be helpful to document explicitly what GRANTs the dbt-coves database user needs

noel commented

@mattppal we are using the dbt adapter, nothing special in terms of permissions. I wonder if dbt would complain with the permissions you had initially e.g. like if you do dbt docs generate that also needs to get info on the column data types. etc

@noel Just ran into the issue again and pinpointed the fix— it's running GRANT ALTER ON TABLE xyz to the appropriate user 👍

ssassi commented

Closing as not a dbt-coves issue.