-
-
Notifications
You must be signed in to change notification settings - Fork 74
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DuckDBType.Date representation as DateTime/DateOnly #232
Comments
You can use DuckDBDataReader.GetFieldValue<> to read those columns with a desired type. |
I cannot - this processing is inside the lib, and it simply reads all values via |
Those libraries return |
This makes exactly this particular ADO.NET provider DuckDB.NET incompatible with huge number of libraries that only target netstandard2.0 or netstandard2.1 and if this concrete lib doesn't require any net6/net8/net9 etc specific API, it should not have special builds for these targets. It is considered that modern NET apps (NET8+) can consume netstandard-compatible libs without problems. That's why it is good idea to return only known types (DateTime instead of DateOnly) for DbDataReader.GetValue and DbDataReader.GetValues methods - and this is how DuckDB.NET netstandard2.1 actually works (it is weird that important API behaviour changes depending on the build, in fact). In my case, it seems I'll need to wrap |
I understand where you are coming from and it would be good to be compatible with those libraries but it would be great if those libraries moved to .NET Core and added support for modern data type as well as migrate to As for specific APIs from modern .NET, this library avoids boxing when reading numeric types on .NET 8:
Also, |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
It seems DuckDB.NET handles date columns differently in netstandard and net6/net8 builds: https://github.com/Giorgi/DuckDB.NET/blob/develop/DuckDB.NET.Data/Internal/Reader/DateTimeVectorDataReader.cs
System.DateOnly is not available in netstandard2.1, and this causes weird situation when DuckDB.NET is referenced from, say, net8 app (so dates are returned in DbDataReader as System.DateOnly) but when datareader is processed in the netstandard2.1 library it simply cannot handle these values because it knows nothing about this type which even cannot be converted to DateTime (via Convert.ToDateTime, for instance).
It would be helpful to have an option to specify which .NET type use for date-only values (for net6+ builds).
The text was updated successfully, but these errors were encountered: