Skip to content

Use dynamic schema names rather than hardcoded ones #223

@dbeatty10

Description

@dbeatty10

Describe the feature

To allow all schemas to be PR-specific, replace any hardcoded schema names with the dynamic target.schema that comes from the dbt connection profile.

Additional context

In our CI tests, we have steps like this:

dbt --warn-error run-operation create_source_table

Within that macro, we create a schema named codegen_integration_tests__data_source_schema (which is a hard-coded name):

{% set target_schema=api.Relation.create(
database=target.database,
schema="codegen_integration_tests__data_source_schema"
) %}

This could lead to permissions errors if different database users are trying to modify this schema.

Who will this benefit?

This will benefit maintainers that want CI tests to be reliable and robust rather than finicky.

In particular, I think it will help overcome permissions errors faced in these PRs:

Are you interested in contributing this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions