Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

snowflake_pipe error creating. This session does not have a current database. #533

Closed
bubalush opened this issue Apr 30, 2021 · 5 comments
Closed
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:pipe Issue connected to the snowflake_pipe resource

Comments

@bubalush
Copy link

Provider Version

0.25.0

Terraform Version

0.14.10

Describe the bug

snowflake_pipe resource can not be created. The following error received:

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

  on input_health_snowpipe.tf line 50, in resource "snowflake_pipe" "xxxxx":
  50: resource "snowflake_pipe" "xxxxxx" {

Expected behavior

Snowpipe should be created

Code samples and commands

resource "snowflake_pipe" "xxx" {
  name              = "xxxx"
  database          = "testo"
  schema            = "testo_dev"
  comment           = "Ingestion pipe events."
  copy_statement    = "copy into testo.testo_dev.xxxx from @xstage"
  auto_ingest       = true
  aws_sns_topic_arn = "arn::"
}

Additional context

The SQL query created by snowflake TF provider works if use the worksheet in Snowflake console.

@bubalush bubalush added the bug Used to mark issues with provider's incorrect behavior label Apr 30, 2021
@vsayer
Copy link

vsayer commented May 6, 2021

resource "snowflake_pipe" "xxx" {
name = "xxxx"
database = "testo"
schema = "testo_dev"
comment = "Ingestion pipe events."
copy_statement = "copy into testo.testo_dev.xxxx from @Xstage"
auto_ingest = true
aws_sns_topic_arn = "arn::"
}

If you need a workaround in the meantime, just fully-qualify the stage, i.e., @DATABASE.SCHEMA.xstage. That got it working for me.

Original: #135 (comment)

@mmsieth
Copy link

mmsieth commented Oct 14, 2021

resource "snowflake_pipe" "xxx" {
name = "xxxx"
database = "testo"
schema = "testo_dev"
comment = "Ingestion pipe events."
copy_statement = "copy into testo.testo_dev.xxxx from @Xstage"
auto_ingest = true
aws_sns_topic_arn = "arn::"
}

If you need a workaround in the meantime, just fully-qualify the stage, i.e., @DATABASE.SCHEMA.xstage. That got it working for me.

Original: #135 (comment)

I'm still seeing this bug. I'm using Terraform v1.0.9 and provider[registry.terraform.io/chanzuckerberg/snowflake] 0.25.19. Fully qualifying the stage name works for me.

@rubemz
Copy link

rubemz commented Jun 30, 2022

still seeing this bug, fully qualifying the stage name works... but it would be nice to not need to do that.

@russell
Copy link

russell commented Feb 28, 2024

It also causes another bug when you have a file format that didn't use the fully qualified name, because then you'll get the error.

So you have to fully qualify all things that stage depends on because otherwise they might not work.

As seen in the snowflake query log

SQL compilation error: File format 'MY_JSON' does not exist or not authorized.

Or the terraform message

 Error: [errors.go:17] object does not exist or not authorized

@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:pipe Issue connected to the snowflake_pipe resource labels May 20, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Closing as deprecated. Please use newer versions of the provider and create a new issue if the error persist there.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:pipe Issue connected to the snowflake_pipe resource
Projects
None yet
Development

No branches or pull requests

7 participants