Ravi
Ravi

Reputation: 233

dbt to snowflake connections fails via profiles.yml

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

Upvotes: 8

Views: 15970

Answers (5)

Sr Jefers
Sr Jefers

Reputation: 129

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.

Upvotes: 0

superjisan
superjisan

Reputation: 2074

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

Upvotes: 6

Akbar
Akbar

Reputation: 61

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.

Upvotes: 0

luther
luther

Reputation: 264

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>

Upvotes: 3

Stephan
Stephan

Reputation: 601

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.

Upvotes: 9

Related Questions