terraform-provider-snowflake icon indicating copy to clipboard operation
terraform-provider-snowflake copied to clipboard

Stage resource does not specify database in transaction

Open cfraleig opened this issue 3 years ago • 1 comments

Provider Version

0.25.36

Terraform Version

1.1.7

Describe the bug

When adding a new stage resource, getting this error

Error: error creating stage CONVOY_KAFKA_S3_STAGE: 090105 (22000): Cannot perform operation. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.

Expected behavior

Because the stage resource builds with a fully qualified name, I would expect this to not be an issue. I suspect snowflake would use the default catalog assigned to the user or service account used to make the call to snowflake. but if there is no default catalog, it doesn't use the database name passed into the resource.

Code samples and commands

this is from a TF apply

Additional context

apply output:

 # module.stage__lz_kafka_s3.snowflake_stage.stage will be created
  + resource "snowflake_stage" "stage" {
      + aws_external_id    = (known after apply)
      + copy_options       = "ON_ERROR=ABORT_STATEMENT,SIZE_LIMIT=16777216,PURGE=false,RETURN_FAILED_ONLY=false,MATCH_BY_COLUMN_NAME=NONE,ENFORCE_LENGTH=true,TRUNCATECOLUMNS=false,FORCE=false"
      + database           = "DB_NAME_HERE"
      + file_format        = "FORMAT_NAME=a_file_format"
      + id                 = (known after apply)
      + name               = "stage_name"
      + schema             = "My_schema"
      + snowflake_iam_user = (known after apply)
      + url                = "an_s3_url"
    }

cfraleig avatar May 04 '22 16:05 cfraleig

The same happens for pipes. See https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/533

rubemz avatar Jun 30 '22 16:06 rubemz

We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket.

sfc-gh-asawicki avatar Apr 30 '24 16:04 sfc-gh-asawicki