dbt to snowflake connections fails via profiles.yml
Asked Answered
G

5

8

I'm trying to connect to snowflake via dbt but connections fail with the error below:

Using profiles.yml file at /home/myname/.dbt/profiles.yml
Using dbt_project.yml file at /mnt/c/Users/Public/learn_dbt/rks-learn-dbt/learn_dbt/dbt_project.yml
Configuration:
  profiles.yml file [ERROR invalid]
  dbt_project.yml file [OK found and valid]
Profile loading failed for the following reason:
Runtime Error
  Could not find profile named 'learn_dbt'
Required dependencies:
 - git [OK found] 

Any advice please.

Note: I am learning to setup dbt connections looking at udemy videos.

Below is my profiles.yml file:

learn_dbt:
  target: dev
  outputs:
    dev:
      type: snowflake
      account: XXXXXX
      user: XXXX                
      password: XXXX                     
      role: transform_role
      database: analytics
      warehouse: transform_wh
      schema: dbt
      threads: 1
      client_session_keep_alive: False
Groundsel answered 3/7, 2020 at 7:46 Comment(0)
F
9

My first guess is that you have a profiles.yml file in your dbt project folder and dbt is not actually using the one in /home/myname/.dbt/.

Could you try running the following?

dbt debug --profiles-dir /home/myname/.dbt

The flag --profiles-dir works on most dbt cli commands and lets you use a custom profiles.yml that's outside your project. I use this flag all the time.

Fremitus answered 4/7, 2020 at 1:55 Comment(2)
Thanks for response Stephen . But still there is no luck , i tried .dbt folder copied into ~./learn_dbt folder . Now getting this error "250003: Failed to get the response. Hanging? method: post, url: se15650.us-east-2 . When i tried to search in our stack over flow about this error, there was a response in this link #59471742 , but the response in this link i tried but that still didn't help. Any other thoughts.Groundsel
I think figured out the issue i,e it was account_id which should be in the format of 'xe12345.us.-east-1.aws' (which should be in single quotes)Groundsel
B
6

I had to run pip install dbt-snowflake and then it worked.

It seems dbt has seperated it's modules to dbt-core and it's adapters dbt-snowflake, dbt-postgres etc

Bloodcurdling answered 19/11, 2021 at 19:36 Comment(1)
this worked for me!, thanks mateAmphictyony
M
3

I think this is a similar issue to what i had when using the cloud environment.

If you are using a snowflake instance on the West coast the the account name looks like

If you are using a snowflake instance on the East coast the the account name looks like <xxx12345.us-east-1>

Metaphrast answered 9/7, 2020 at 14:57 Comment(0)
F
0

Overall this error mean it is unable to connect to yead your environment template to get your snowflake account details.

'env.pd.template.bat' or 'env.pd.template.sh' is the base file which has your Snowfalke account settings, so you have run this command to connect to snowflake from your editor.

You can use '.bat', or .sh commands based on Powershell or CMD editor.

In my scenario I ran 'env.pd..private.bat', you need to run this command everytime to connect to snowflake account with your credentials. I ran this in cmd window. It fixed my error.

Foreignism answered 15/11, 2021 at 10:26 Comment(0)
F
0

I think that something change on the connector or maybe at the account names on the side of snowflake but the next steps worked for me.

  1. Log into your account, you can jump to the step number 3
  2. On the top left menu where you can see your name, click on it and on the menu choose for the SingOut option.
  3. You are going to be redirected to -> https://app.snowflake.com/
  4. Insert your account number or select your account from the accounts listed
  5. On the next page where you are supposed to insert your credentials such as user and password, check on the URL, there is going to be something such like abc123468.us-east-0.snowflakecomputing.com/, you are going to require the abc123468.us-east-0 from the URL, copy and paste it into your profiles.yml file in the account tag.
  6. Execute your dbt debug and wait for the connection to be done.

It worked for me becouse I didn't had an extra sso auth activated, if you are using something such like OKTA or another auth method maybe this is not going to work.

Another method to get this URL that I mentioned on the steps before, in the bottom left corner you can find this information. enter image description here

Always refer to the official docs for more info -> https://docs.getdbt.com/docs/cloud/connect-data-platform/connect-snowflake

One last! Be sure that the role that you selected is able to usage and select data from the database and schema.

Forceps answered 26/9, 2023 at 19:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.