Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit cc7b813

Browse files
authored
Fix for query folding issue with direct query mode in Power BI data connector (#640)
* pbi connector * update names * - add mez file - add docs * nit * nit * image resize * resize image * remove extra lines * nit * update mez file * rename connector * rename mez file * - add basic & aws auth - add unit test - add errors - enable direct query * add connector * update doc * add ssl for auth * update docs for errors * - remove sqlgetinfo & sqlcapabilities values from connector * adding EncryptedConnectionString * add data type for columns * add alternate column size * reverting changes in catalog test * nit * revert changes for column size validation * address PR comments * Update SQL_GROUP_BY value for fixing query folding issue * removing AstVisitor for resolving query folding issue with data type boolean
1 parent 68678b2 commit cc7b813

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

sql-odbc/src/IntegrationTests/ITODBCInfo/test_odbc_info.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ TEST_SQL_GET_INFO_VERSION_GE(SQLDBMSVer, SQL_DBMS_VER, L"7.1.1");
180180

181181
TEST_SQL_GET_INFO_STRING(SQLColumnAlias, SQL_COLUMN_ALIAS, L"Y");
182182
TEST_SQL_GET_INFO_UINT16(SQLGroupBy, SQL_GROUP_BY,
183-
SQL_GB_GROUP_BY_EQUALS_SELECT);
183+
SQL_GB_GROUP_BY_CONTAINS_SELECT);
184184
TEST_SQL_GET_INFO_STRING(SQLIdentifierQuoteChar, SQL_IDENTIFIER_QUOTE_CHAR,
185185
L"`");
186186
TEST_SQL_GET_INFO_UINT_MASK(SQLOJCapabilities, SQL_OJ_CAPABILITIES,

sql-odbc/src/PowerBIConnector/OdfeSqlOdbcPBIConnector.pq

+5-21
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ OdfeSqlOdbcPBIConnectorImpl = (Host as text, optional Port as number) as table =
7878
Driver = "ODFE SQL ODBC Driver"
7979
],
8080

81+
SQLGetInfo = Diagnostics.LogValue("SQLGetInfo_Options", [
82+
SQL_AGGREGATE_FUNCTIONS = ODBC[SQL_AF][All]
83+
]),
84+
8185
SQLGetTypeInfo = (types) =>
8286
if (EnableTraceOutput <> true) then types else
8387
let
@@ -102,26 +106,6 @@ OdfeSqlOdbcPBIConnectorImpl = (Host as text, optional Port as number) as table =
102106
Value.ReplaceType(toTable, Value.Type(source))
103107
else
104108
source,
105-
106-
// Add support for `LIMIT` and `OFFSET` clauses (rather than `TOP`)
107-
AstVisitor = [
108-
// format is "LIMIT [<skip>,]<take>" - ex. LIMIT 2,10 or LIMIT 10
109-
LimitClause = (skip, take) =>
110-
if (take = null) then
111-
...
112-
else
113-
let
114-
skip =
115-
if (skip = null or skip = 0) then
116-
""
117-
else
118-
Number.ToText(skip) & ","
119-
in
120-
[
121-
Text = Text.Format("LIMIT #{0}#{1}", { skip, take }),
122-
Location = "AfterQuerySpecification"
123-
]
124-
],
125109

126110
OdbcDatasource = Odbc.DataSource(ConnectionString & Server & CredentialConnectionString & EncryptedConnectionString, [
127111
// Do not view the tables grouped by their schema names.
@@ -136,9 +120,9 @@ OdfeSqlOdbcPBIConnectorImpl = (Host as text, optional Port as number) as table =
136120
ClientConnectionPooling = true,
137121

138122
// These values should be set by previous steps
139-
AstVisitor = AstVisitor,
140123
SQLColumns = SQLColumns,
141124
SQLGetTypeInfo = SQLGetTypeInfo,
125+
SQLGetInfo = SQLGetInfo,
142126

143127
OnError = OnOdbcError,
144128

Binary file not shown.

sql-odbc/src/odfesqlodbc/info.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ RETCODE SQL_API ESAPI_GetInfo(HDBC hdbc, SQLUSMALLINT fInfoType,
245245

246246
case SQL_GROUP_BY: /* ODBC 2.0 */
247247
len = 2;
248-
value = SQL_GB_GROUP_BY_EQUALS_SELECT;
248+
value = SQL_GB_GROUP_BY_CONTAINS_SELECT;
249249
break;
250250

251251
case SQL_IDENTIFIER_CASE: /* ODBC 1.0 */

0 commit comments

Comments
 (0)