Giorgi / DuckDB.NET

Bindings and ADO.NET Provider for DuckDB
https://duckdb.net
MIT License
338 stars 61 forks source link

Implement Connection.GetSchema #185

Closed hazzik closed 1 month ago

hazzik commented 1 month ago

This PR implements Connection.GetSchema.

Standard collections: ✔️ MetaDataCollections ✔️ Restrictions ✔️ ReservedWords ❌ DataSourceInformation ❌ DataTypes

Non standard common collections ✔️ Tables ✔️ Columns ✔️ ForeignKeys ✔️ Indexes

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.41%. Comparing base (6270bac) to head (1033016). Report is 35 commits behind head on develop.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #185 +/- ## =========================================== + Coverage 87.83% 88.41% +0.58% =========================================== Files 42 54 +12 Lines 1504 1761 +257 Branches 217 239 +22 =========================================== + Hits 1321 1557 +236 - Misses 127 146 +19 - Partials 56 58 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 9155702909

Warning: 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


Files with Coverage Reduction New Missed Lines %
DuckDB.NET.Data/DuckDBCommand.cs 1 89.83%
DuckDB.NET.Data/Internal/Reader/VectorDataReaderBase.cs 1 88.27%
DuckDB.NET.Data/Internal/PreparedStatement.cs 3 93.33%
DuckDB.NET.Data/Internal/Reader/DateTimeVectorDataReader.cs 3 90.2%
<!-- Total: 8 -->
Totals Coverage Status
Change from base Build 9119577775: 0.7%
Covered Lines: 1615
Relevant Lines: 1761

💛 - Coveralls
Giorgi commented 1 month ago

Is it still WIP?

hazzik commented 1 month ago

Yes, want to implement a few more essential collections.

Giorgi commented 1 month ago

I'll mark it as Draft. Please mark it ready for review when it's finished. Thanks

hazzik commented 1 month ago

Ok. This is ready for review now. I've implemented almost all metadata I wanted, except IndexColumns, that seems to be impossible to implement. Also, I have not implemented DataTypes and DataSourceInformation standard collections as I don't have interest in them. If that's is required it would be possible to implement later.

Giorgi commented 1 month ago

Thanks, I'll try to review it in the next few days. Is there any documentation on how GetSchema should work and what kind of structure it should return?

hazzik commented 1 month ago

The documentation is really loose, the basic description of how it should work is here: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/retrieving-database-schema-information.

With common schema collections and custom collections that are available via informational_schema catalog it is more-or-less settled, but for custom collections it becomes trickier (in context of this PR it is only Indexes collection): the column names and information do not often match between providers.

Giorgi commented 1 month ago

Thanks, merged.

hazzik commented 1 month ago

Thank you

Giorgi commented 1 month ago

@hazzik This is now live on NuGet.