Forum Discussion
OLE DB or ODBC error: [DataSource.Error] ODBC: ERROR [42601] SQL compilation error: ambiguous column
- 5 years ago
In this case the best (and preferred option) in my opition is to create a view in snowflake.
Inside the view rename the field. The connect PowerBi to View instead of Table
Do not rename the field directly in the table. I wouldnt recommend that
Hello jacob-dickey
Do you actually mean whether PowerBI can add the right aliases right next to field names?
This cannot be done by PowerBI.
To give you some context.
The query that you wrote will also through the same error message if you run it to any database client. It is database generated error and not PowerBI one. In other words the error says that you didnt write the query properly and you need to make the necessary amendments.
On your query you use 2 tables ITBL and OTBL. For all fields you have used an alias but not on the fields in the where statement. This is bad writing of a SQL Query.
Also Created field is one of the main fields in a database table. If you dont specify the table alias correctly it will return wrong data.
The solution in your case is to put an alias (ITBL or OTBL) in front of every field in the where statement.
I hope that helped
Correct, I agree that is the problem with the query. However, I did not write that query, Power BI DirectQuery did.
I found that query in my Snowflake query history after getting the error in Power BI.
- themistoklis5 years agoCommunity Champion
If i remember correctly you can not write a custom query and send it through PowerBI to snowflake.
You can only connect directly to tables in Snowflake. Corrct me if im wrong.
My understanding is that you have multiple steps in Power Query editor and one of the steps joins 2 tables. Is this right?
If this is the case, i think the best way to overcome this issue is by adding one more step and delete the duplicate columns from the table you are not interested in. I hope tis makes sense??
- jacob-dickey5 years agoFrequent Visitor
Correct, from what I can understand, you cannot send custom queries through Power BI. You can only bring in tables and join them by creating relationships in the data model. This is how I joined the tables that appear in my query above.
I agree, I think the problem will be solved if one of the "CREATED" columns was removed from the data model so that only one would appear in the DirectQuery result. However, I am using both "CREATED" columns in various parts of the report.
Do you think currently the only option would be to edit the base table in Snowflake to rename the column? If so, I would consider this error to be a bug for Power BI. I would think it should be able to handle this kind of report operation.- themistoklis5 years agoCommunity Champion
In this case the best (and preferred option) in my opition is to create a view in snowflake.
Inside the view rename the field. The connect PowerBi to View instead of Table
Do not rename the field directly in the table. I wouldnt recommend that