Comments (11)
I was experiencing the same bug, and at least for me, it was resolved by a dbt run
prior to using generate_model_yaml
from dbt-codegen.
Experienced the same issue using Redshift myself, I figured out a temporary patch that you can clone/use from my fork. The only change I needed to make was in the macro itself, changing the relation variable assignment from:
{% set relation=ref(model_name) %}
to
{% set relation=api.Relation.create(identifier=model_name) %}
@dbeatty10 unsure if this is just a redshift only issue, presumably the ref() function should return a relation object as it is, but I'm starting to cap out my knowledge of the dbt codebase to try an troubleshoot this deeply.
from dbt-codegen.
I also found that generate_base_model
has no columns in renamed CTE on BigQuery like the below.
with source as (
select * from {{ source('foo', 'bar') }}
),
renamed as (
select
from source
)
select * from renamed
The operation depends on source
to gather column names.
dbt-codegen/macros/generate_base_model.sql
Lines 3 to 5 in c00701b
On the other hand, generate_source
still works correctly because the macro depends on the API, as @trouze described
dbt-codegen/macros/generate_source.sql
Lines 54 to 58 in c00701b
So, I think, ref
and source
cannot collect columns by some reasons.
from dbt-codegen.
Was able to fix this issue by running dbt run --select <model_name>
before trying to generate the model's YAML, you sohuld try this !
from dbt-codegen.
So, I had the same issue but on Snowflake. I was missing schema from the source file that we generated, adding it to the source made it work
from dbt-codegen.
I encountered the same issue, running on Redshift.
from dbt-codegen.
Thanks for opening @pkanter! 🙌
And thank you for the helpful affirmations and work arounds @hesterluu, @abhineetgupta, and @trouze 🧠
Based on the experience of @abhineetgupta, I'm wondering if forcing dependencies is needed.
I'm surprised by the experience reported by @trouze -- if the latter works, I'd expect the former to work also.
from dbt-codegen.
Thanks for this report @hiro-o918
Are you also using Redshift? Or a different warehouse?
from dbt-codegen.
Thank you for quick response 🙏
I use BigQuery
from dbt-codegen.
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.
from dbt-codegen.
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.
from dbt-codegen.
Related Issues (20)
- `generate_model_yaml` keeps the docs blocks with `upstream_descriptions` HOT 2
- Improving interface within a dbt repo using `just` HOT 11
- generate_source doesn't get table names if `table_names` is none HOT 3
- Allow default codegen macros to be overridden
- Include secure views in generate_source macro (via get_relations_by_pattern macro) HOT 2
- Generate source does not work on External schema in Redshift HOT 2
- dbt_project.yml version is not matching with the latest release version HOT 1
- `generate_model_yaml` with `upstream_descriptions: true` should also read descriptions from upstream `sources`.
- (Postgres) Macro generate_model_yaml does not work with Materialized Views HOT 6
- How to generate data types that include size, precision, scale, etc. HOT 2
- Sorted column support in generate_source HOT 4
- Generate basic tests in model yaml HOT 2
- Fill in model/column descriptions when available in database metadata HOT 2
- Support for preserving case in `generate_source` HOT 1
- create_base_models should accept leading_commas and case_sensitive_cols arguments
- `generate_base_model()` doesn't work across databases on Redshift
- Create a release for new features HOT 1
- get_models seems broken in 1.8 HOT 2
- Generate Source, but for external files
- generate_model_yaml: Argument for Quoted Identifiers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-codegen.