0 Kudos

cannot folder expression - data connector and PostgreSQL

Status: Accepted
by xsgao_pbi Visitor on ‎08-27-2018 12:38 PM

I want connect to Postgres ODBC data source with direct query enabled. So I took this sample project, https://github.com/Microsoft/DataConnectors/tree/master/samples/ODBC/SqlODBC, point Config_DriverName variable to "PostgreSQL Unicode(x64)" (name of my psqlODBC driver, version 03.51), and set ConnectionString based on a working ODBC DSN.

 

I am using Power BI Desktop, Version 2.61.5192.601 64-bit (August 2018), and there is no problem to add one table to my Power BI report.

 

But whenever I put a column into a table (or any other viz), I got this error:

OLE DB or ODBC error: [Expression.Error] We couldn't fold the expression to the data source. Please try a simpler expression.

And it happened to any column, varchar, number or date.

 

My original post on github: https://github.com/Microsoft/DataConnectors/issues/143

Status: Accepted
Comments
by xsgao_pbi Visitor
on ‎01-02-2019 11:19 AM

We got this fix by adding SQLGetTypeInfo and SQLColumns functions. PostgreSQL ODBC driver returns some duplicate types with same type names, and making them unique fixed the problem - no "cannot fold expression" errors now.

by sowrk Visitor
on ‎01-29-2019 02:43 AM

Hi @xsgao_pbi,

 

I am running into the same problem that you encountered. I created a custom connector to connect to postgres ODBC datasource with direct query enabled.

I get the 'Cannot fold expression to the datasource" error. But once I add the SQLGetTypeInfo and SQLColumns functions, not even able to load data from a table in PBI desktop due to an error - "Expression error - Token literal expected"

Could you please elaborate on your solution. Should the SQLGetTypeInfo function be modified to return only unique types? And any changes required in SQLColumns function?

 

 

by yuvrajyr Occasional Visitor
on ‎02-17-2019 11:00 PM

Even i am running into the same problem.

I have tried using Table.Distinct to remove duplicate type name, but still getting the same problem.

 

@xsgao_pbi  can you please share how you got it working?

 

 

Idea Statuses