Skip to content
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

Error while passing schema inside the model using {{ config(materialized='table',schema='schema')}} #2

Closed
puruku opened this issue May 4, 2022 · 0 comments · Fixed by #23
Assignees
Labels
bug Something isn't working

Comments

@puruku
Copy link

puruku commented May 4, 2022

Hi ,

  • if i pass schema inside my model either as config parameter({{ config(materialized='table',schema='schema')}}) or as source parameter ({{source('schema','table')}}) , the model fails with the following error.
    Model 'model.Test_project.model_name' (models/pod_os_stats/model_name.sql) depends on a source named 'schema.table' which was not found
  • if i remove the schema from source parameter and keep it in the config getting below error
    dbt.exceptions.CompilationException: Compilation Error in macro oracle__create_schema (macros/adapters.sql)
    'relation' is undefined
    in macro create_schema (macros/adapters/schema.sql)
    called by macro oracle__create_schema (macros/adapters.sql)
  • if i remove the schema from both config and source parameter simply use the table name it succeeds.
ThoSap pushed a commit to ThoSap/dbt-oracle that referenced this issue May 9, 2022
ThoSap pushed a commit to ThoSap/dbt-oracle that referenced this issue May 10, 2022
ThoSap pushed a commit to ThoSap/dbt-oracle that referenced this issue May 11, 2022
Signed-off-by: Thomas Sapelza <sapelza.thomas@gmail.com>

Signed-off-by: Thomas Sapelza <thomas.sapelza@gknpm.com>
ThoSap pushed a commit to ThoSap/dbt-oracle that referenced this issue May 11, 2022
Signed-off-by: Thomas Sapelza <sapelza.thomas@gmail.com>

Signed-off-by: Thomas Sapelza <thomas.sapelza@gknpm.com>
@aosingh aosingh self-assigned this Jun 7, 2022
@aosingh aosingh added the bug Something isn't working label Jun 7, 2022
aosingh added a commit that referenced this issue Jun 7, 2022
1. Following macros changed or fixed in adapter.sql to use custom schema name - oracle__create_schema, oracle__create_view_as, oracle__alter_relation_comment, oracle__alter_column_type, oracle__drop_relation, oracle__truncate_relation, oracle__rename_relation, oracle__make_temp_relation

2. Changed view materialization strategy which unncessarily created an intermediate <model>__dbt_tmp view first and renamed it to the target view. Now we directly CREATE or REPLACE view <target_view_name>

3. Added generate_schema_name.sql as per dbt documentation in test project to determine the name of the schema that a model should be built in.

4. Changed a couple of models in the test project to use custom schema

5. Fixes Bug #14

6. Fixes Bug #2

7. Addresses issues raised in PR #15
@aosingh aosingh added the work-in-progress Planned in the upcoming release label Jun 8, 2022
@aosingh aosingh mentioned this issue Jun 10, 2022
@aosingh aosingh removed the work-in-progress Planned in the upcoming release label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants