Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
pupreti
Frequent Visitor

SQL statement with DirectQuery option does not load data for creating reports

Hi All,

I am working on power bi desktop custom connector and i am using Presto as the datasource, i am passing SQL statement with direct query option. I am able to see the data but when i load the data to create reports then desktop throws below error.

"We couldn't connect to your DirectQuery data source or internal model. Double-check that your server and database names are correct, and that you have permission to access them. DirectQuery error: DirectQuery may not be used with this data source – please consider moving to a supported data source or upgrading the SQL Server data source to the latest available version."

 

On my connctor side code, i am calling Odbc.Query(ConnectionString, SQL) if SQL is not null and if its null then i am calling Odbc.DataSource function. Do you think am i missing any optional property in Odbc.query or is there anything wrong in my code because of which i am getting this error while loading reports?

Below is the snippet of my code:

Connect = 
            if (SQL = null) then 
                Odbc.DataSource(ConnectionString, [
                HierarchicalNavigation = true,
                HideNativeQuery = false,
                TolerateConcatOverflow = true,
                SqlCompatibleWindowsAuth = false,
                ClientConnectionPooling= true,
                SoftNumbers = true,
                SqlCapabilities = [
                    PrepareStatements = true,
                    SupportsTop = true,
                    Sql92Conformance = 8,
                    SupportsNumericLiterals = true,
                    SupportsStringLiterals = true,
                    SupportsOdbcDateLiterals = true,
                    SupportsOdbcTimeLiterals = true,
                    SupportsOdbcTimestampLiterals = true
                    ]
                ])
            else
                Odbc.Query(
                ConnectionString, 
                SQL)
    in
        Connect;

Can anyone suggest me, is there anything worng in my code, or is this issue from Power BI side?

Please suggest anything that anyone has. Thank you so very much in advance. 

 

PS: I am using the latset Power BI version 2.82.5858.1161 64-bit (June, 2020) and directquery option is enable in my code.

4 REPLIES 4
v-eachen-msft
Community Support
Community Support

Hi @pupreti ,

 

Your codes seem to be correct, here is the link about Odbc.Query() for your reference.

You could launch Power BI Desktop as an administrator(right click on the power bi app, then select "run as admin"), and then make the connection.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-eachen-msft ,

I had tried launching power bi in administrator mode also but it still shows the same error.

lbendlin
Super User
Super User

I think they are complaining about your SQL server version. Do you know what that is?

Hi @lbendlin ,

I am using Presto, not directly SQL and also i am not querying to any table of SQL, i am querying to hive Although, my presto server has sql as a connector and has sql installed of version 5.1.73.

Do you think it might be causing the issue?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.