cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sbobba Frequent Visitor
Frequent Visitor

Custom Connector ODBC - Conversion error from string to varchar

Hi 

 

I have a custom connector written for ODBC to enable direct query in Power BI. When I am testing it out I am running it into below error - 

 

SimpleDocumentEvaluator/GetResult/Evaluate {"Start":"2020-02-06T16:25:54.9123041Z","Action":"SimpleDocumentEvaluator/GetResult/Evaluate","HostProcessId":"25832","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.1040025"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0300042Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"AdjustForCompatibility","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000173"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0303225Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","ErrorMessage":"Failed to convert type string to varchar, expression `OTBL`.`sgmtl_rptg_cd` to `ITBL`.`sgm_cd`.","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0015620"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0319004Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"AdjustTextValuesForCompatibility","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000102"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0319192Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"ConvertForSize","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000053"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0319321Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","Function Name":"Convert","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0000045"}
OdbcQuery/FoldingWarning {"Start":"2020-02-06T16:25:55.0322693Z","Action":"OdbcQuery/FoldingWarning","HostProcessId":"25832","ErrorMessage":"Failed to convert from string to string for expression `OTBL`.`sgmtl_rptg_cd`. You can override this by using SqlGetInfo for converting from WVARCHAR to WLONGVARCHAR.","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0004697"}
OdbcQueryDomain/ReportFoldingFailure {"Start":"2020-02-06T16:25:55.0333843Z","Action":"OdbcQueryDomain/ReportFoldingFailure","HostProcessId":"25832","Exception":"Exception:\r\nExceptionType: Microsoft.Mashup.Engine1.Runtime.FoldingFailureException, Microsoft.MashupEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMessage: Folding failed. Please take a look the information in the trace.\r\nStackTrace:\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.Convert(OdbcTypeInfo typeInfo, OdbcScalarExpression expression)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.ConvertForSize(OdbcScalarExpression left, OdbcScalarExpression right, Int32 size, Boolean fallbackToLargestType)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.AdjustTextValuesForCompatibility(OdbcScalarExpression left, OdbcScalarExpression right)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.AdjustForCompatibility(OdbcScalarExpression left, OdbcScalarExpression right, Precision precision)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryExpressionVisitor.VisitEquals(OdbcSqlExpression leftExpression, OdbcSqlExpression rightExpression, Precision precision, Boolean nullable)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryDomain.OdbcOptimizingQueryVisitor.VisitJoinCore(JoinQuery joinQuery)\r\n at Microsoft.Mashup.Engine1.Library.Odbc.OdbcQueryDomain.OdbcOptimizingQueryVisitor.VisitJoin(JoinQuery joinQuery)\r\n\r\n\r\n","ProductVersion":"2.76.5678.782 (19.12)","ActivityId":"81cf1593-40cd-45af-9327-2d08dd8a8689","Process":"Microsoft.Mashup.Container.NetFX45","Pid":22924,"Tid":1,"Duration":"00:00:00.0082509"}

 

I have tried to overwrite SQL_CONVERT_WVARCHAR and SQL_CONVERT_WLONGVARCHAR, but I'm still seeing this error. Below is my SQLGetInfo. 

 

 

 

           SQLGetInfo = [
                // SQLGetinfo Overrides: https://docs.microsoft.com/en-us/power-query/odbc#overriding-sqlgetinfo
                SQL_AGGREGATE_FUNCTIONS = 0x0000007F,
                SQL_CONVERT_BIGINT = 0x000273D8,
                SQL_CONVERT_BIT = 0x000273D8,          
                SQL_CONVERT_FUNCTIONS = 0x00000003,
                SQL_CONVERT_INTEGER = 0x000273D8,
                SQL_CONVERT_LONGVARCHAR = 0x000273D8,
                SQL_CONVERT_REAL = 0x000273D8,
                SQL_CONVERT_SMALLINT = 0x000273D8,
                SQL_CONVERT_TIMESTAMP = 0x00023318,
                SQL_CONVERT_TINYINT = 0x000273D8,
                SQL_CONVERT_VARCHAR = 0x000273D8,
                SQL_CONVERT_WLONGVARCHAR = 0x000C273D8,
                SQL_CONVERT_WVARCHAR = 0x000C273D8,
                SQL_IDENTIFIER_QUOTE_CHAR = "`",
                SQL_GROUP_BY = 2,
                SQL_NUMERIC_FUNCTIONS = 0x007FFFEF,
                SQL_SCROLL_OPTIONS = 0x00000011,
                SQL_SQL_CONFORMANCE = 8,
                SQL_SQL92_DATETIME_FUNCTIONS = 0x00000007,
                SQL_SQL92_PREDICATES = 0x00001E07,
                SQL_SQL92_RELATIONAL_JOIN_OPERATORS = 0x00000158,
                SQL_SQL92_STRING_FUNCTIONS = 0x00000009,
                SQL_SQL92_VALUE_EXPRESSIONS = 0x00000007,
                SQL_STRING_FUNCTIONS = 0x00053FFF,
                SQL_SYSTEM_FUNCTIONS = 0x00000006,
                SQL_TIMEDATE_FUNCTIONS = 0x001E7FE7
            ],

 

 

 

Can any one help me out figuring this error and how to resolve it? Thanks for the help

 

 

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors