-
-
Notifications
You must be signed in to change notification settings - Fork 87
Add ClassMap-based type-safe appender API to DuckDB.NET #296
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
base: develop
Are you sure you want to change the base?
Conversation
Co-authored-by: Giorgi <[email protected]>
Co-authored-by: Giorgi <[email protected]>
@copilot This is completely different. What you should do:
|
I've reverted all changes. Could you provide more details on the ClassMap approach you'd like? Should it be similar to FluentMapping with property-to-column mappings, or would you prefer a different pattern? Also, should this support the generic |
Co-authored-by: Giorgi <[email protected]>
@copilot Yes, it should support the |
Co-authored-by: Giorgi <[email protected]>
Implemented the Key features:
See commit d8a3f92 for the full implementation and ClassMap-Usage.md for documentation. |
@copilot Better, but not 100%. The mapper and appender should retrieve the appender column types (like the appender already does) and if the mapped property type does not match it, it should throw an exception. No casting at the moment. Here is an example mapping class: public DeathMap()
{
Map(m => m.NhsNumber);
Map(m => m.death_date);
Map(m => m.death_datetime);
Map(m => m.death_type_concept_id);
Map(m => m.cause_concept_id);
Map(m => m.cause_source_value);
Map(m => m.cause_source_concept_id);
DefaultValue();
NullValue();
}
|
Co-authored-by: Giorgi <[email protected]>
Implemented per your requirements:
Example from your comment works: public DeathMap()
{
Map(m => m.NhsNumber);
Map(m => m.death_date);
Map(m => m.death_datetime);
Map(m => m.death_type_concept_id);
Map(m => m.cause_concept_id);
Map(m => m.cause_source_value);
Map(m => m.cause_source_concept_id);
DefaultValue();
NullValue();
} See commit f8e7c2a for implementation. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #296 +/- ##
===========================================
- Coverage 87.76% 86.97% -0.79%
===========================================
Files 67 69 +2
Lines 2337 2465 +128
Branches 334 353 +19
===========================================
+ Hits 2051 2144 +93
- Misses 204 229 +25
- Partials 82 92 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pull Request Test Coverage Report for Build 18406925343Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Key Changes from Feedback
1. Type Validation Against Database Schema
The mapped appender now retrieves actual column types from the appender and validates them:
2. Support for Default and Null Values
3. Simplified API
Mappings are defined in column order without explicit
.ToColumn()
calls:How It Works
Example
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.