Open jaredx435k2d0 opened 1 year ago
HI @jaredx435k2d0 thanks for opening this issue.
Unfortunately with how all of our source packages are created, you will not be able to materialize the staging models as ephemeral. They will either need to be views or tables.
This is particularly necessary due to this cte that exists in all of our staging models. This is required to ensure users of the package see a successful run regardless if they have all the fields in the source that we are querying in the staging model. In order for this to work we leverage the adapter.get_columns function in dbt. Unfortunately, this function requires the model it is reference and the model itself to be a view or table.
As this is an integral part to our package infrastructure we likely will not make this update to the package. Although I understand you desire and wish we could have the adapter function work for ephemeral models. If you wish to get around this, I would recommend forking the package and removing that cte. This way you can take advantage materializing as ephemeral while avoiding the macro if you in fact have all of the columns. Otherwise, you can override the models and add your own custom models that do not leverage this cte.
Is there an existing issue for this?
Describe the issue
Due to #32, I'm considering
ephemeral
as the materialization type for netsuite_source, so that I can then create my own staging schema that has all of the tables my connector is bringing in.The only alternatives I can think of is to try to put them in the same schema, which would cause name conflicts, or to have two staging schemas for the same source, which will be confusing for everyone. Since nobody will directly use the staging models from netsuite_source anyway, I figure it's ok to abstract / hide them away in ephemeral models.
When I try to do this, all fields for all records for all models are null. When I look in my
target
folder, I can see the generated SQL is explicitly usingnull
as the value for everything.Is there a way I can use ephemeral as the materialization for netsuite_source?
Relevant error log or model output
target/compiled/netsuite_source/models/netsuite2/stg_netsuite2__transaction_lines.sql:
Expected behavior
I would expect the CTEs to use the actual fields rather than nulls.
dbt Project configurations
Package versions
What database are you using dbt with?
snowflake 7.12.3
dbt Version
Additional Context
If I switch
materialized
toview
then it all works great.I'm using Python 3.10.10.
Are you willing to open a PR to help address this issue?