Snowflake-Labs / sqltools-snowflake-driver

A Snowflake driver for the SQLTools VSCode extension.
MIT License
35 stars 15 forks source link

connection error #29

Open fishstoryyy opened 3 years ago

fishstoryyy commented 3 years ago

Hi everyone, I am getting the following network error when testing a connection.

1616032517283] ERROR (ls): Connecting error: {"code":401001,"data":{"driver":"Snowflake","driverOptions":{}},"name":"NetworkError"}
    ns: "conn-manager"
[1616032517284] ERROR (ext): ERROR: Error opening connection Network error. Could not reach Snowflake., {"code":401001,"data":{"driver":"Snowflake","driverOptions":{}}}
    ns: "error-handler"
[1616032522861] INFO  (ext): EXECUTING COMMAND => sqltools.showOutputChannel

Not sure if it is caused by my account name. My account name (the part left to .snowflakecomputing.com) follows a format like this: letters_only.us-east-1.companyname

If the account name is not the cause, could it be a proxy issue?

Can someone please help? Really looking forward to making use of this extension.

koszti commented 3 years ago

👋 the companyname is probably not required in the account. The account

The regular pattern of the account is: <account_name>[.<region_id>][.<cloud>]. (e.g. 'xy12345.east-us-2.azure') , and it needs to be one of the supported account locators listed at https://docs.snowflake.com/en/user-guide/connecting.html#your-snowflake-account-name . Can you please check the link above and try with the supported snowflake account locators?

If you're connecting to snowflake not via the listed account locators but through an internally managed proxy then it's currently not supported by this sql client.

btw, a new version (0.4.2) of the sql client is published to VSCode Marketplace with some more information on the connection form. Can you please upgrade, try again and let me know how is it going?

fishstoryyy commented 3 years ago

Thank you for your response. My apology for a late reply.

With regards to the example xy12345.east-us-2.azure you gave and other account locators listed here, what I should use to replace xy12345? My url looks like this: https://prod.us-east-1.companyname.snowflakecomputing.com.

Thanks you very much in advance.

anujghai commented 3 years ago

I'm presuming yo fixed it. If not I suggest installing snowsql https://docs.snowflake.com/en/user-guide/snowsql-start.html and then on linux/mac login via snowsql -a <account>> -u <<user> That way you can confirm all is okay before using this connector.

fishstoryyy commented 3 years ago

Hi anujghai,

I haven't found a fix yet. I was able to get it work on Python through the snowflake-connector-python but once I copy and paste the same credentials (account name and password) to this connector, the connection didn't go through.

anujghai commented 3 years ago

Okay, I tested with the python connector using a script like below (Replace with yours). Once tested I used the Snowflake Driver with the same user account,user, password as my test and included the database warehouse and schema and warehouse with OOSCP Fail-Open ticked and get a connection. Personally I have never seen the company name embedded in the account name. `

!/usr/bin/env python

import snowflake.connector import getpass

uname = input('Enter Username: ') pword = getpass.getpass(prompt='Enter password: ', stream=None)

Gets the version

ctx = snowflake.connector.connect( user=uname, password=pword, account='' ) cs = ctx.cursor() try: cs.execute("SELECT current_version()") one_row = cs.fetchone() print(one_row[0]) finally: cs.close() ctx.close() `

freddietattersall commented 1 year ago

@fishstoryyy - did you ever find a solution here? My account name is companyname.eu-west-1 and I receive the same error. Again, it works just fine with the python connector.