Skip to content
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

Implementation of the Connection.GetSchema of the DataSourceInformation collection #190

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

magneto-81
Copy link
Contributor

No description provided.

Copy link
Owner

@Giorgi Giorgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added some minor comments.

@@ -20,6 +22,7 @@ internal static class DuckDBSchema
collectionName.ToUpperInvariant() switch
{
"METADATACOLLECTIONS" => GetMetaDataCollections(),
"DATASOURCEINFORMATION" => GetDataSourceInformation(NativeMethods.Startup.DuckDBLibraryVersion().ToManagedString(false)),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with connection.ServerVersion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

serverVersion,
serverVersion,
GroupByBehavior.Unrelated,
"(^\\[\\p{Lo}\\p{Lu}\\p{Ll}_@#][\\p{Lo}\\p{Lu}\\p{Ll}\\p{Nd}@$#_]*$)|(^\\[[^\\]\\0]|\\]\\]+\\]$)|(^\\\"[^\\\"\\0]|\\\"\\\"+\\\"$)",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comments explaining what these regexes do/mean and where they come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments.

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.73%. Comparing base (292bc55) to head (028df4d).

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

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #190      +/-   ##
===========================================
+ Coverage    88.38%   88.73%   +0.35%     
===========================================
  Files           54       54              
  Lines         1756     1802      +46     
  Branches       239      239              
===========================================
+ Hits          1552     1599      +47     
+ Misses         146      145       -1     
  Partials        58       58              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

coveralls commented May 20, 2024

Pull Request Test Coverage Report for Build 9157409247

Details

  • 46 of 46 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 90.42%

Totals Coverage Status
Change from base Build 9156112100: 0.2%
Covered Lines: 1657
Relevant Lines: 1802

💛 - Coveralls

@Giorgi
Copy link
Owner

Giorgi commented May 21, 2024

Is it possible to test it some other way? I.E what uses connection.GetSchema("DataSourceInformation")?

@magneto-81
Copy link
Contributor Author

Connection.GetSchema("DataSourceInformation") is used by generic software which, through the ado.net providers, allows its use. The information returned by this primitive is used to generate statements in a generic way (see for example DbMetaDataColumnNames.ParameterMarkerPattern).

@Giorgi
Copy link
Owner

Giorgi commented May 28, 2024

Can you add a test that uses those APIs (that call Connection.GetSchema("DataSourceInformation")) under the hood to validate that it generates correct statements? That would increase the confidence of this change a lot.

// https://duckdb.org/docs/sql/query_syntax/prepared_statements
{
"\\.",
"DuckDB",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you return “DuckDB”, but test checks for “duckdb” (lowercase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants