Skip to content

Conversation

guenp
Copy link

@guenp guenp commented Mar 29, 2024

Fixes motherduckdb/duckdb-power-query-connector#16
When reading UTF-8 encoded data from DuckDB via Power Query SDK or Power BI, the ODBC driver's diagnostics logs return errors:

ODBC_DuckDB->SQLGetInfo
Unrecognized attribute: 1750
ODBC_DuckDB->SQLGetInfo
Unrecognized attribute: 180

This is likely due to Power Query sending SQLGetInfo requests with TypeInfo values that are not supported by the ODBC driver, in particular, SQL_DTC_TRANSACTION_COST (1750) and SQL_RETURN_ESCAPE_CLAUSE (180) . This PR adds support for these InfoTypes to SQLGetInfo to enable reading UTF-8 encoded files in Power Query SDK and Power BI. I also added a line to add the info_type to the diagnostics logs.

Some relevant info from MS docs:

Although SQL_DTC_TRANSITION_COST was introduced in ODBC 3.5, an ODBC 2.x driver can also support it because the driver manager will query this information regardless of the driver version.

See a similar implementation in the PostgreSQL ODBC driver here on line 1047.

Before fix:
image

After fix:

image image

See here for repro steps.

@guenp
Copy link
Author

guenp commented Mar 29, 2024

Comment with initial report of this issue: #10907 (comment)

@github-actions github-actions bot marked this pull request as draft March 29, 2024 16:31
@guenp guenp marked this pull request as ready for review March 29, 2024 16:32
Guen Prawiroatmodjo added 3 commits March 29, 2024 13:50
@guenp guenp force-pushed the guenp/fix-sqlgetinfo-1750-unknown-attribute branch from bc6ec9c to 59fca1d Compare March 29, 2024 20:53
@github-actions github-actions bot marked this pull request as draft March 29, 2024 20:54
@guenp
Copy link
Author

guenp commented Mar 29, 2024

Rebased branch onto main and added a preventative fix to SQLTables such that it does not return nothing if return code is SQL_SUCCESS_WITH_INFO

@guenp guenp marked this pull request as ready for review March 29, 2024 20:54
@Mytherin Mytherin requested a review from maiadegraaf April 2, 2024 09:07
Copy link
Contributor

@maiadegraaf maiadegraaf left a comment

Choose a reason for hiding this comment

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

Thanks for adding this, looks good to me!

@Mytherin Mytherin merged commit 6f8acef into duckdb:main Apr 9, 2024
github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Apr 9, 2024
Merge pull request duckdb/duckdb#11580 from Mytherin/unneststructcleanup
Merge pull request duckdb/duckdb#11576 from szarnyasg/reprox-labels
Merge pull request duckdb/duckdb#11575 from Mytherin/permissions
Merge pull request duckdb/duckdb#11423 from guenp/guenp/fix-sqlgetinfo-1750-unknown-attribute
Merge pull request duckdb/duckdb#11382 from guenp/guenp/ignore-pq-driver-key
@guenp guenp deleted the guenp/fix-sqlgetinfo-1750-unknown-attribute branch April 9, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"The table has no visible columns and cannot be queried." when reading UTF-8 encoded data with DuckDB 0.10.1+ ODBC driver
3 participants