3

I would like to set up Snowsql client so I can connct for the first time and run commands like PUT.

I dont know where to find exacte values of :

accountname = xxxx
username = xxxx
password = xxxx

When I run following command from Windows command prompt :

C:\Users\noureddine.ettalhi>snowsql -a ettalhi -u ettalhi
Password:
250001 (08001): Failed to connect to DB. Verify the account name is correct: ettalhi.snowflakecomputing.com:443. HTTP 403: Forbidden
If the error message is unclear, enable logging using -o log_level=DEBUG and see the log to find out the cause. Contact support for further help.
Goodbye!

It kept saying the mentioned error. so what value should I give for account ?

where are the steps to follow to use SnowSql for the first time ?

Thanks.

5 Answers5

1

The account name is a part of the URL used to access your snowflake account, in my case it is vq985xx.ca-central-1.aws since my URL is https://vq985xx.ca-central-1.aws.snowflakecomputing.com

This is explained in snowflake documentation , link : https://docs.snowflake.net/manuals/user-guide/getting-started-tutorial-log-in.html#step-1-log-into-snowsql

1

Since you are using snowsql client you may also create profiles in the config files located at .snowsql/config

[connections.MY_DEV]
accountname = myco.us-east-1
username = myuserid
database = mydb
role = mydb_admin
schema =  myschema
warehouse = my_WH

Once you have set up a profile this then you can specify the snowsql -c My_DEV will prompt for password .. just another way

Gajoseph
  • 21
  • 2
1

Use fully qualified account name i.e Name + Regional Zone + Cloud Provider Name

For example:

  1. your account name is oi12345
  2. Regional zone is ca-central-1
  3. Cloud provider is aws

Then your fully qualified account name is oi12345.ca-central-1.aws

Now let's say your userName is bestUser123

Now your command should be:

snowsql -a oi12345.ca-central-1.aws -u bestUser123

whitetiger1399
  • 423
  • 3
  • 6
  • This answer was for me a lot more helpful than the snowflake documentation – Arnaud Potier Aug 10 '22 at 14:43
  • Ditto Arnaud. I've pored over the snowflake documentation and nowhere did it give this info. I assumed (wrongly) that clicking on "Copy account identifier" when hovering over the account in the bottom left of Snowsight would suffice. What's the point in "Copy account identifier" if it doesn't copy everything that you need to connect? – jamiet Mar 11 '23 at 21:11
0

Presuming you are using the Canadian AWS Trial Instance:

/* 1 liner */
SELECT LOWER(CONCAT('SNOWSQL -A ', LOWER(CURRENT_ACCOUNT()), '.', LOWER(REPLACE(CURRENT_REGION(), 'AWS_', '')), '.AWS -U ', LOWER(CURRENT_USER())));
/* Formatted */
SELECT LOWER(CONCAT('SNOWSQL -A '
                  , LOWER(CURRENT_ACCOUNT())
                  , '.', LOWER(REPLACE(CURRENT_REGION(), 'AWS_', ''))
                  , '.AWS -U '
                  , LOWER(CURRENT_USER())
                   )
            );

Should return you something like:

snowsql -a your_account_id_here.ca-central-1.aws -u your_user_name_here

  1. Copy the result
  2. Paste into powershell or command line
  3. Enter your password
  4. Wait ~10 seconds for it to connect
JayRizzo
  • 3,234
  • 3
  • 33
  • 49
-1

To get accountname use CURRENT_USER() function that will return account name that you need to combine with region segment from this page https://docs.snowflake.net/manuals/user-guide/getting-started-tutorial-log-in.html#step-1-log-into-snowsql.