snowflake-db-net-client icon indicating copy to clipboard operation
snowflake-db-net-client copied to clipboard

General Feedback

Open fixer-m opened this issue 5 years ago • 15 comments

Hi everyone!

In this thread you can leave your feedback on this project.

Since this is a new project I'm looking for a feedback on whether it's useful or not - considering that there is official .NET connector. What features do you think this client should have to actually compete with official connector? How is Snowflake generally used in .NET applications?

As well as I would appreciate bug reports and features request - please, create new separate issue for this.

Thank you!

fixer-m avatar Sep 27 '20 12:09 fixer-m

Hey, @BillSytin, @BretMishler, @Ferprimart, @KLia, @NICK-AKINCILAR, @NeilP-global, @SHI-WEI, @SarekaAvinash, @ThijsKoot, @VantageKR, @WATYF, @ZhixinY, @acosta32, @agianakas, @alexrosenfeld10, @borysl, @chinmayasarangi, @dcrdev, @dsilejbdebt, @extremeandy, @ikudjoi, @imathiesonpwx, @jjjain, @mhunting, @mloidolt, @moravas, @onema, @pcchannz, @pielegacy, @qmatto, @rdagumampan, @realrael2, @rjpaddock, @rpatterson32, @sandeepkumarkhatri, @sanjeevsinh, @snosrap, @stegus64, @timkracht, @wildgordo, @zlatinal

Since you have created some issue(s) in Snowflake.Data project - I think you might be interested in this project.

fixer-m avatar Sep 27 '20 12:09 fixer-m

Hi, I like the idea of your project and am currently looking into it for a customer as we agree with your view on the limitations of the default connector.

However, I am a having some trouble getting started: When I run the Snowflake.Client.Tests.IntegrationTests they all fail due to an ssl connection error. The same happens when I try to use your client in a custom project (basically what is suggested in the README).

Is this something snowflake enforces recently and you are just still missing? Or do I have to make configurations for SSL support myself? I am running the code in Visual Studio 2019. Cheers

FSohns93 avatar May 25 '21 12:05 FSohns93

Hi, @FSohns93!

Thanks for your interest in this project!

There were some issues with SSL in previous versions, but now they all should be fixed (see https://github.com/fixer-m/snowflake-db-net-client/issues/7). Can you please create new issue here with some details? I'm gonna need exact error message, your Snowflake URL and region you use.

To make integration tests work you should populate testconfig.json with your connection info.

fixer-m avatar May 25 '21 12:05 fixer-m

Thanks @fixer-m for coming back so fast. I hadn't checked issue #7 yet, but in general it seems similar to my problem:

  • region is also "west-europe"
  • error message is similar

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

I will check this further and comment here.

FSohns93 avatar May 25 '21 14:05 FSohns93

@FSohns93, got it. Can you please create new issue with this info?

fixer-m avatar May 25 '21 18:05 fixer-m

Works great -- running into snowflake wanting to chunk on small data sets 1000 rows which has created some issues. But in general super easy to use.

joshbartelsudig avatar Jun 09 '21 21:06 joshbartelsudig

Can you add support for keyfiles instead of username/password? See https://github.com/snowflakedb/snowflake-connector-net (possibly skip private_key_pwd)

conn.ConnectionString = "account=testaccount;authenticator=snowflake_jwt;user=testuser;private_key_file={pathToThePrivateKeyFile};private_key_pwd={passwordForDecryptingThePrivateKey};db=testdb;schema=testschema";

Ekus avatar Nov 15 '21 17:11 Ekus

@Ekus Sorry, it took me too long to answer. That's possible, yes, but unfortunately right now I don't have much time for this project. Currently I'm working on chunks downloader, which will allow to consume big responses from SF.

fixer-m avatar Nov 22 '21 09:11 fixer-m

@joshbartelsudig Hey! I've finally released chunks downloader, i.e. it can now handle big data responses. Check out new version on NuGet.

fixer-m avatar Jan 29 '22 19:01 fixer-m

Feel free to delete if this is the wrong thread to ask this question but is it possible to use this library as a provider for the Entity Framework?

lawrence-vo avatar May 03 '22 14:05 lawrence-vo

@lawrence-vo, No. If you want to use Snowflake with EF, you actually need other package: Snowflake.Data - ADO.NET connector provided by Snowflake. However I think that using EF with Snowflake or any other OLAP warehouse might be an overkill. You can read about the differences between these two libraries at readme page.

fixer-m avatar May 09 '22 15:05 fixer-m

Hey Mate, great library and we are using it. May I request adding support to pass the warehouse name during the client initialization? We have a default warehouse which is used when none is passed and our IT department would like us to use our specific assigned Warehouse to run any queries. Thanks!

sourabhtewari avatar Jan 30 '23 23:01 sourabhtewari

@sourabhtewari Hi! This already should be working. There is SessionInfo parameter in SnowflakeClient constructor:

var snowflakeClient = new SnowflakeClient(new AuthInfo
{
    User = "username", 
    Password = "password", 
    Account = "account", 
    Region = "region"
},
new SessionInfo
{
    Warehouse = "warehouse" // <= set your warehouse name 
}); 

fixer-m avatar Feb 07 '23 10:02 fixer-m

EDIT: I just realized that what I was reading is the v2 Snowflake API, and this library seems to use the v1 API. I have no idea if the below still applies.... please let me know if it doesn't.

EDIT2: I've since resolved my issue... at the end of the day, it was caused by Dapper's default behavior which buffers the entire response before returning. Changing that single setting resulted in negligible memory utilization when working with the same queries.


@fixer-m I'm curious to know how exactly do you handle partitioned results in this library.

We have a scenario here where we are reading a 50 million-record set and this is allocating insane amounts of memory using the standard connector + Dapper (over 60gb of RAM).

I'm currently investigating ways to reduce that load to "reasonable" levels, and was looking at potentially switching to your library.

At the same time, I was taking a look at the Snowflake REST API documentation and saw what they do with larger sets using partitions, where you make multiple calls to fetch the different partitions:

  • https://docs.snowflake.com/en/developer-guide/sql-api/handling-responses#retrieving-additional-partitions

This "partitioned fetching" would work perfect for our use case as we would allocate just enough memory for each partition, write it to the target file, and then fetch the next partition. Sure this would mean a ton of requests, but at least it would be a more scalable solution that doesn't create insane memory spikes for us.

I don't want to introduce manual paging to our procedure if I can leverage this built-in partitioning mechanism, but apparently the standard connector doesn't surface this in any way, so we end up loading the entire dataset in memory before we start writing that into our .csv file.

At the same time, their REST API is fairly convoluted, so I'd also like to avoid consuming it directly...

How does your library deal with it? An ideal implementation in my mind would be to expose an IAsyncEnumerable that automatically navigates the partitions while returning the records as needed. This would allows us to iterate asynchrnously and write the records seamlessly.

julealgon avatar Jul 21 '23 21:07 julealgon

@sourabhtewari Hi! This already should be working. There is SessionInfo parameter in SnowflakeClient constructor:

var snowflakeClient = new SnowflakeClient(new AuthInfo
{
    User = "username", 
    Password = "password", 
    Account = "account", 
    Region = "region"
},
new SessionInfo
{
    Warehouse = "warehouse" // <= set your warehouse name 
}); 

Is there a way to pass and validate the sessionToken to the SnowflakeClient and create a new renewSession when expired?

ejricahuerta avatar Oct 11 '23 18:10 ejricahuerta