Skip to content

command running 'create schema if not exists' when schema exists #354

@SigridAndersen

Description

@SigridAndersen

Describe the bug

After version 0.8.3 run-operation stage_external_sources runs a ddl statement create schema if not exists. This is an issue for us because the user does not have permission to create datasets, and we don't want to allow this. The statement is run even if the schema already exists in the database.
Checking if the schema exists, and only running the statement if the schema is missing would fix the problem.

Steps to reproduce

run run-operation stage_external_sources with user/serviceaccount without bigquery.datasets.create permission

Expected results

External source is created. This is the result up to version 0.8.2

Actual results

Error message:

Encountered an error while running operation: Database Error
Access Denied: Project my-bq-project: User does not have bigquery.datasets.create permission in project my-bq-project.

System information

The contents of your packages.yml file:
packages:

  • package: dbt-labs/dbt_external_tables
    version: 0.8.3

Which database are you using dbt with?

  • redshift
  • snowflake
  • other (specify: bigquery)

The output of dbt --version:

latest

The operating system you're using:

The output of python --version:

Additional context

Running on dbt cloud

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions