snowflake-connector-net icon indicating copy to clipboard operation
snowflake-connector-net copied to clipboard

Snowflake throw Exception when I add role=PUBLIC in connectionString

Open touchdreamer opened this issue 3 years ago • 1 comments
trafficstars

Issue description

I add role=PUBLIC in snowflake connectionString, but it can't work.

Error log

Unhandled exception. Snowflake.Data.Client.SnowflakeDbException (0x80004005): Error: The requested warehouse does not exist or not authorized. SqlState: 08006, VendorCode: 390201, QueryId: at Snowflake.Data.Core.SFSession.ProcessLoginResponse(LoginResponse authnResponse) at Snowflake.Data.Core.Authenticator.BaseAuthenticator.Login() at Snowflake.Data.Core.Authenticator.BasicAuthenticator.Snowflake.Data.Core.Authenticator.IAuthenticator.Authenticate() at Snowflake.Data.Core.SFSession.Open() at Snowflake.Data.Client.SnowflakeDbConnection.Open()

Configuration

Driver version:

*Dotnet framework and version: net framework 4.7.2

Server version: E.g. 1.90.1 You may get the server version by running a query:

SELECT CURRENT_VERSION();

Client OS: E.g. Debian 8.1 (Jessie), Windows 10

touchdreamer avatar Oct 19 '22 03:10 touchdreamer

My connection string: account=microsoft_partner.east-us-2.azure;user=WENCHAOHU;db=TEST_DB;warehouse=ADF_QUERY_TEST;password=************;role=PUBLIC

touchdreamer avatar Oct 19 '22 03:10 touchdreamer

hi and thank you for reporting this issue; also apologies for the long period without response. we'll take a look and i'll update this issue with the progress, if any

sfc-gh-dszmolka avatar Jun 08 '23 11:06 sfc-gh-dszmolka

findings: the role works as expected in the connection string, however if the particular role used in the connection string does not have USAGE privilege on the particular warehouse used in the connection string, then it's expected to fail with The requested warehouse does not exist or not authorized error, coming from the Snowflake backend and not the driver.

so this part is expected to happen. what might not be expected, is if we necessarily need to throw an unhandled exception on this one - still discussing internally.

sfc-gh-dszmolka avatar Jun 14 '23 10:06 sfc-gh-dszmolka

thank you for the patience on this. after some discussion, SnowflakeDbException is standard SF exception thrown if connection fails because of any reason. "Unhandled exception" only means that the user didn't catch the exception. So this behaviour is expected and the reason is also expected (see above). Marking this issue as closed but if you feel you saw a bug , please feel free to update this issue with the details in the comment.

sfc-gh-dszmolka avatar Jun 28 '23 09:06 sfc-gh-dszmolka