SqlHydra

SqlHydra is a suite of NuGet packages for working with databases in F# including code generation tools and query expressions.

MIT License

Stars
223

Bot releases are visible (Hide)

SqlHydra - SqlHydra.Query v1.1.2

Published by JordanMarr over 1 year ago

Adds support in select statement where clauses for reversing order of column/value. Previously, the table column/property always had to be on left side of the comparison:

  select {
      for a in addressTable do
      where (a.AddressID > 5)
  }

Now it can be on either side:

  select {
      for a in addressTable do
      where (5 < a.AddressID && a.AddressID <= 20)
  }

Thanks to @ntwilson for this improvement! 🎉

SqlHydra - v1.1.1 - Simplified CLI wizard with "use cases"

Published by JordanMarr almost 2 years ago

v1.1.1 updates all the SqlHydra code generator tools to simplify the TOML configuration wizard that runs when a TOML file is not detected.
This update establishes three main "use cases" supported by SqlHydra.
Please see the updated TOML wiki page for more details:

https://github.com/JordanMarr/SqlHydra/wiki/TOML-Configuration#generating-toml-file

SqlHydra - v1.1.0 / .NET 7 / Same Table Joins

Published by JordanMarr almost 2 years ago

SqlHydra.Query and SqlHydra.* (code gen)

  • All packages have been updated to v1.1.0
  • All packages support .NET 5, .NET 6 and now .NET 7

SqlHydra.Query

  • Same table joins are now supported.
    • Behind the scenes, all select queries now use table aliases instead of fully qualified table names (required to support same table joins).
  • inSchema function is no longer needed (now deprecated/obsolete because schema can be inferred from generated types parent module).
    • This makes it easier to specify your tables within your query instead of doing it ahead of time:
      select {
          for order in table<dbo.Orders> do
          select token
      }
    
  • Updated to SqlKata v2.4.0.

Thanks to @jwosty for his huge contributions toward the same table join feature!

SqlHydra - Support for Implicit Conversions

Published by JordanMarr almost 2 years ago

SqlHydra.Query v1.0.5 adds support for F# implicit conversions in where expressions.

Example 1: Comparing a decimal value (p.ListPrice) with an int constant now works as expected:

select {
    for p in productTable do
    where (p.ListPrice > 5)
}

Example 2: Comparing a decimal option (p.Weight) with an int constant now works as expected:

select {
    for p in productTable do
    where (p.Weight = Some 5)
}

Thanks to aciq for his awesome pull request!

SqlHydra - Npgsql Support for (more) Arrays

Published by JordanMarr almost 2 years ago

SqlHydra.Npgsql v1.0.5 adds adds support for arrays for the remaining PostgreSQL primitive data types, including:

  • boolean
  • smallint
  • integer
  • bigint
  • real
  • double precision
  • numeric
  • money
  • text
  • bit(1)
  • date
  • date without timezone
  • timestamp with time zone
  • time with time zone
SqlHydra - Npgsql Support for Arrays

Published by JordanMarr almost 2 years ago

SqlHydra.Npgsql v1.0.4 adds support for text[] and integer[] columns.

There are other types that can support arrays, but I wanted to add the requested types first.
If you would like to see more array types added, please post an issue that we can use to come up with a more comprehensive list.

SqlHydra - SQL Server getId uniqueidentifier fix

Published by JordanMarr about 2 years ago

Fixes getId for SQL Server inserts when using GUID/UNIQUEIDENTIFIER column.
https://github.com/JordanMarr/SqlHydra/issues/38

SqlHydra - SQL Server DATETIME2 Fix

Published by JordanMarr about 2 years ago

This release affects SqlHydra.SqlServer and SqlHydra.Query so that the SQL Server DATETIME2 parameter type is properly detected and set based on the generated types. (Previously, DATETIME2 columns were being set as DATETIME parameter types which caused a loss of precision.)

SqlHydra.SqlServer v1.0.3

  • Generated record properties now specify the ProviderDbType attribute for DateTime fields with either DATETIME or DATETIME2.

SqlHydra.Query v1.0.3

  • The ProviderDbType has now been fixed to check for generated ProviderDbType attributes in both where and having parameters as well as in updates and inserts.

Thanks to @ntwilson for contributing this fix!

SqlHydra - TimeOnly Fixes

Published by JordanMarr over 2 years ago

Fixes TimeOnly for most packages

  • SqlHydra.Query v1.0.2
    • Now manually converts DateOnly parameter values to DateTime
  • SqlHydra.SqlServer v1.0.2
    • Now generates a custom GetDateOnly extension method
  • SqlHydra.Npgsql v1.0.3
    • Now generates a custom GetDateOnly extension method
  • SqlHydra.Sqlite v1.0.2
    • Now generates a custom GetDateOnly extension method
SqlHydra - DateOnly Fixes

Published by JordanMarr over 2 years ago

Fixes DateOnly support for all packages:

  • SqlHydra.Query v1.0.1
    • Now manually converts DateOnly parameter values to DateTime
    • Still targets netstandard2.0 (mostly for Xamarin Forms 5), but now also targets .net5.0 and .net6.0
  • SqlHydra.SqlServer v1.0.1
    • Now generates a custom GetDateOnly extension method
  • SqlHydra.Npgsql v1.0.2
    • Now generates a custom GetDateOnly extension method
  • SqlHydra.Sqlite v1.0.1
    • Now generates a custom GetDateOnly extension method
  • SqlHydra.Oracle v1.0.1
    • Now generates a custom GetDateOnly extension method

.NET 7 Preparation

  • Converted #if NET6_0 conditionals to #if NET6_0_OR_GREATER
SqlHydra - v1.0.1 Upgraded to Npgsql v6.0.4

Published by JordanMarr over 2 years ago

SqlHydra.Npgsql 1.0.0 used Npgsql v6.0.3 which had a bug that throws an exception during SqlHydra.Npgsql code generation if an enum exists an a schema other than public. This bug has been fixed in Npgsql v6.0.4.

SqlHydra.Npgsql 1.0.1 now uses Npgsql v6.0.4.

SqlHydra - Upsert for Postgres and Sqlite

Published by JordanMarr over 2 years ago

SqlHydra.Query

Postres Upsert Support

Added the following new operators to the insert, insertAsync and insertTask builders
(requires: open SqlHydra.Query.NpgsqlExtensions):

  • onConflictDoUpdate
  • onConflictDoNothing

SqlHydra.Sqlite Upsert Support

Added the following new operators to the insert, insertAsync and insertTask builders
(requires: open SqlHydra.Query.SqliteExtensions):

  • onConflictDoUpdate
  • onConflictDoNothing
  • insertOrReplace

See examples in readme:
https://github.com/JordanMarr/SqlHydra#upsert

General

  • Bumped to 1.0!
    Enough time has passed that I think the API has settled, and I'm pretty happy with the the set of supported providers and features. 🚀
SqlHydra - Postgres Enum Support

Published by JordanMarr over 2 years ago

New Features

SqlHydra.Npgsql

SqlHydra.* (all providers)

  • Streamlined CLI wizard
    • No longer prompts user to choose a default reader type (that's a rare edge case that can be handled manually in toml file)
    • Info message now prompts user to install the appropriate ADO.NET provider NuGet package
    • Better info messages in general
SqlHydra - v0.800 - New Async and Task Builders!

Published by JordanMarr over 2 years ago

The overarching goal of this release was to make cleaner, prettier query builders that are:

  • self-contained - meaning the query results can be transformed within the query block
  • self-executing - meaning they query results execute automatically without piping to various external execute methods

New Builders

  • selectAsync
  • selectTask
  • updateAsync
  • updateTask
  • insertAsync
  • insertTask
  • deleteAsync
  • deleteTask

New Select Builder Operations

  • toList
  • toArray
  • mapList
  • mapArray
  • mapSeq

New builders are self-executing

The new builders can automatically execute without manually piping into the QueryBuilder methods.
This along with the new mapList, mapArray and mapSeq methods makes the queries expressions completely self-contained.

Explicit QueryContext and Connection Scope Handling

The QueryContext must be passed into the new builders as either Create which takes a function that initializes a new QueryContext and automatically disposes it when its done , or Shared which uses an already initialized context.
Using the Create context type makes it now possible to have self-contained query functions that do not need to be wrapped in a task or async block, which looks so much cleaner!

SqlHydra - v0.700.0 - Oracle Support Added

Published by JordanMarr over 2 years ago

SqlHydra.Oracle Released!

  • Oracle type generation is now supported via SqlHydra.Oracle
  • Oracle querying is now supported via SqlHydra.Query
SqlHydra -

Published by JordanMarr almost 3 years ago

SqlHydra.*

All SqlHydra generators now support both .NET 5 and .NET 6!
This includes the new .NET 6 types, System.DateOnly and System.TimeOnly.
See readme for details.

SqlHydra -

Published by JordanMarr almost 3 years ago

SqlHydra.Npgsql

  • Added support for inserting and updating json and jsonb data types with Npgsql (and new attribute subsystem for overriding the parameter type in the generated types which is now available to be used by all providers).
    Thanks to @MargaretKrutikova for adding this very difficult feature and subsystem!
SqlHydra -

Published by JordanMarr almost 3 years ago

SqlHydra.Query

  • BREAKING CHANGE: InsertBuilder entities operation now takes new AtLeastOne type as input.

SqlHydra.*:

  • Both tables and now columns can be filtered in generated types.
  • Generated columns for all providers are now sorted by ordinal.
    Thanks to @Jmaharman for this improvement!
  • Improved code generation tests using Verify
    Thanks to @Jmaharman for this improvement!
SqlHydra -

Published by JordanMarr almost 3 years ago

SqlHydra.Npgsql

  • Now generates views
    Thanks to @MargaretKrutikova!
SqlHydra -

Published by JordanMarr almost 3 years ago

SqlHydra.Query

  • Added the following methods to QueryContext to add support for passing CancellationToken:
    • GetReaderAsyncWithOptions
    • ReadAsyncWithOptions
    • ReadOneAsyncWithOptions
    • InsertAsyncWithOptions
    • DeleteAsyncWithOptions
    • CountAsyncWithOptions
      Thanks to @MargaretKrutikova for this feature!

SqlHydra.*

  • Added support for both net5.0 and now net6.0!
    (net5.0 will be dropped once official support ends)
Badges
Extracted from project README
NuGet version (SqlHydra.Cli) NuGet version (SqlHydra.Query)
Related Projects