-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Postgres) Macro generate_model_yaml does not work with Materialized Views #155
Comments
Hey @drewblinn ! thanks so much for the issue -- did a little digging, and I think this may indeed be an issue with I opened an issue on dbt-core over here -- hopefully we can get that fixed soon! |
Thanks for taking a look @dave-connors-3! Let me know if I can help in any way |
Thanks @drewblinn and @dave-connors-3 🏆 Just wrote up an explanation here. TLDR: the definition of the @drewblinn that write-up contains a workaround you can try in the meantime. Could you give it a shot and see if it works for you? |
@dbeatty10 the workaround works great! thanks for your work on this |
Awesome to hear @drewblinn 🎉 I've opened a draft PR that contains this solution: dbt-labs/dbt-core#9433 |
Since we're going to address the underlying issue in dbt-postgres, I'm closing this issue in favor of dbt-labs/dbt-core#9419. |
Describe the bug
The
generate_model_yaml
macro does not return any information about materialized views.The macro queries
information_schema.columns
which does not store data about materialized views.Steps to reproduce
Create a Materialized view
Build the Model
dbt build -s mv_gene_yaml_test
Run the macro
{{ codegen.generate_model_yaml(model_names=['mv_gene_yaml_test']) }}
or
dbt run-operation codegen.generate_model_yaml --args '{"model_names": ["mv_gene_yaml_test"]}'
Expected results
The macro should return columns
Actual results
The macro only returns the model name and description, no columns
Screenshots and log output
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
:Command failed in dbt cloud, but I am using 1.7.4 as seen in the log above
The operating system you're using:
Windows (dbt cloud)
The output of
python --version
:N/A
Additional context
The macro queries
information_schema.columns
which does not store data about materialized views. Column information for MVs can be found inpg_catalog.pg_attribute
Are you interested in contributing the fix?
More than happy to help!
The text was updated successfully, but these errors were encountered: