snowflakedb / snowflake-connector-net

Snowflake Connector for .NET
Apache License 2.0
172 stars 130 forks source link

Compatibility with Entity Framework #426

Open lawrence-vo opened 2 years ago

lawrence-vo commented 2 years ago

Can I use this project as a provider for the Entity Framework? I've noticed some threads previously that reference this as a want but I can't find any documentation on the steps required to make this work.

Thanks!

cristiscu commented 2 years ago

I'm also very interested in this, as we cannot use LINQ unless we use Entity Framework. I tried to get it done with the CData Snowflake provider, which is not free but claims they support this feature. I rather experienced problems.

cristiscu commented 2 years ago

This was never implemented or completed, but very convenient to have it closed by a bot :(

lawrence-vo commented 1 year ago

Snowflake has advertised the use of the unistore for transaction workloads, which (correct me if I'm wrong) would make the some Snowflake tables function as traditional on prem SQL databases.

Surely, this would mean that Entity Framework integration is possible.

colingreen-payroc commented 1 year ago

The lack of a LINQ API into Snowflake will undoubtedly weight against projects/teams choosing to use Snowflake generally. The switch to Snowflake from some other DB tech will require .NET DB access code to switch from EF Core based code with compile-time checked (and safe) LINQ queries, to preconstructed SELECT/INSERT/UPDATE, etc. statement strings. I suspect many teams will push back on that approach; I know I have been, and will continue to do so.

sfc-gh-anugupta commented 11 months ago

Hi All, we plan to add the support for Entity framework support, and it's in our backlog. I dont have any ETA yet, but we will prioritize it as we do the next quarter planning. We will keep this thread updated. Thanks all for your patience.

WilliamDouglasUSI commented 10 months ago

I can't share any of the code we wrote, but I can tell you what we did to use Entity Framework with Snowflake.

Entity Framework is open source here on GitHub. The project EfCore.SqlServer is the SQL Server specific provider. Since the SQL syntax between SQL Server and Snowflake SQL is mostly identical, you can change the coding in this project to connect to Snowflake instead. Do this by:

  1. Remove the project dependency to Microsoft.Data.SqlClient and replace it with Snowflake.Data.
  2. Fix the data type mappings and the other compilation errors step 1 introduced.
  3. Changing the extension methods to accept Snowflake connection string.
  4. Fix SQL statement generation to remove brackets, fix casing, and paging syntax. Some of this will be in the EfCore.Relational project. Derive/override classes from that project into the altered EfCore.SqlServer project so the EfCore.Relational project can remain unaltered.
  5. Remove support for SQL Server specific features like temporal tables.
sfc-gh-anugupta commented 9 months ago

Hi All , we are planning to start with the dev work in early Nov and will be sharing updates as we progress . The dev team may have some questions as we build an early POC for it and will loop in the community for getting feedback . Thanks for all your patience on it. We are looking into adding more ORM support across the Ecosystem in near future

yoliva commented 6 months ago

Hi @sfc-gh-anugupta, there has been any progress with this? we are looking forward to giving it a try :)

sfc-gh-anugupta commented 5 months ago

Thanks all for the patience . We do plan to open up our Private Preview for it in the coming month and will post updates on it . Based on the feedback we receive we will plan the next phases for it .

Sielnix commented 4 months ago

I've implemented Snowflake EF core connector which uses official Snowflake.Data driver. Preview version is released - see it here: https://www.nuget.org/packages/EFCore.Snowflake/

sfc-gh-dszmolka commented 4 months ago

thanks for your work ! we'll also keep this thread posted with the progress and the availability of the official preview EF connector once available.

sfc-gh-dszmolka commented 3 months ago

📢 a quick status update: (partial) private preview of the feature started! Please reach out to your Snowflake Sales representative if you're interested and want to participate. This phase of the preview is closed (meaning only those will be participating, who applied and are/will be enrolled), with the following caveats:

For those who are not yet a Snowflake customer, I'm afraid this stage of the feature preview is not available.

Who are already Snowflake customers and interested: do reach out to your Sales rep., enroll, test the feature; Product and Dev team is very keen on hearing the feedbacks. Thank you all in advance !

edit: ⚠️ please do not reach out to Snowflake Support for onboarding or technical issues related to the Entity Framework Private Preview, they won't be able to help.

sfc-gh-dszmolka commented 1 month ago

📢 Following an internal decision, we're continuing with the private preview phase as mentioned in the above post; so anyone still interested please do reach out to your Snowflake Account Team.

Thank you for your interest in this capability !