fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
564 stars 144 forks source link

Using the provider without requiring access to the DB #738

Closed AlexeyRaga closed 2 years ago

AlexeyRaga commented 2 years ago

It would be very handy to be able to create a provider from a schema file instead of requiring to have an actual connection to the DB. Or maybe something like that already exists?

JordanMarr commented 2 years ago

If you’re using SQL Server you can use a SSDT project dacpac file to build your schema:

https://fsprojects.github.io/SQLProvider/core/mssqlssdt.html

If you’re not using SQL Server there is also a feature that will let you cache your schema.

Thorium commented 2 years ago

The schema cache (serialization to JSON at your choice) is working on all the databases, see the ContextSchemaPath: https://fsprojects.github.io/SQLProvider/core/parameters.html#ContextSchemaPath

That being said, on SQL Server I do recommend the SSDT mentioned above, because then you can have your infrastructure and database in version control and just publish the full thing by Farmer creating a new SQL Server to Azure https://compositionalit.github.io/farmer/api-overview/resources/sql/ and Fake push your database to it: https://fake.build/sql-sqlpackage.html Those should be repeatable deployments.

AlexeyRaga commented 2 years ago

@JordanMarr @Thorium Thanks, this sounds awesome. I am using Postgres, but I will check out tools and features mentioned above.