Releases: JordanMarr/SqlHydra
v1.2.1 correlated subquery support
v1.2.0 Table Declarations
SqlHydra v1.2.0 now generates a table declaration for each table, along with the generated table record.
For example, if you have a table, Sales.Person
, it will now generate a table declaration, Sales.Person
.
Behind the scenes in the generated code, this look like this:
module Sales =
[<CLIMutable>]
type Person = { FName: string; LName: string }
let Person = SqlHydra.Query.Table.table<Person>
You can then use this in your queries:
select {
for p in Sales.Person do
select p
}
How to enable feature
Starting a new project
If running the sqlhydra CLI tool for the first time, you will be prompted to "Select a use case" with three options:
- "SqlHydra.Query integration (default)"
- "Other data library"
- "Standalone"
This option will only be enabled if you choose "SqlHydra.Query integration (default)".
Upgrading from a previous version
If upgrading a previous version, you will need to manually edit your .toml
file in your project folder to add table_declarations = true
within the sqlhydra_query_integration
section.
Example:
[general]
connection = "Data Source=TestData/AdventureWorksLT.db"
output = "Sqlite/AdventureWorksNet6.fs"
namespace = "Sqlite.AdventureWorksNet6"
cli_mutable = true
[sqlhydra_query_integration]
provider_db_type_attributes = true
table_declarations = true
[readers]
reader_type = "System.Data.Common.DbDataReader"
[filters]
include = [ "*" ]
exclude = [ "hr/*" ]
See .toml configuration docs for more details:
SqlHydra.Query v1.1.2
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! 🎉
v1.1.1 - Simplified CLI wizard with "use cases"
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
v1.1.0 / .NET 7 / Same Table Joins
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).
- Behind the scenes, all
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!
Support for Implicit Conversions
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!
Npgsql Support for (more) Arrays
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
Npgsql Support for Arrays
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.
SQL Server getId uniqueidentifier fix
Fixes getId
for SQL Server inserts when using GUID/UNIQUEIDENTIFIER column.
#38
SQL Server DATETIME2 Fix
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 forDateTime
fields with eitherDATETIME
orDATETIME2
.
SqlHydra.Query v1.0.3
- The
ProviderDbType
has now been fixed to check for generatedProviderDbType
attributes in bothwhere
andhaving
parameters as well as in updates and inserts.
Thanks to @ntwilson for contributing this fix!