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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Ffitzpatrick47
Helper II
Helper II

parameterized queries, query folding and postgre

I have a postgre database (which is cheaper than mssql server) and want to make a parameterized query.  Here's my code:

let
parameters = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
pr = Table.TransformColumnTypes(parameters,{{"key", type text}, {"value", type datetime}}),
prs = Table.SelectRows(pr, each ([key] = "Begin date")),
end_date = prs{0}[value],
string = "select * from h_ar_stage gangster = '"& Text.From(end_date) &"'",
Source = PostgreSQL.Database("localhost", "kobe_bryant", [Query="select * from h_ar_stage"])
in
Source

 

I have to munge around with the date format for the code to actually work, but before I do that, does anyone know the story behind this?

http://community.powerbi.com/t5/Issues/Bug-Query-folding-not-working-with-non-SQL-datasource/idi-p/2...

 

When they say non sql, does that mean non sql server, or non ansi sql based queries.  Knowing msft, I think its likely they weren't smart enough to implement their folding code off of odbc logic and are forming the sql code natively.

 

Also, this is so epically kludgey, is there a more official way to handle parameters in power query?  In the normal data tab, they have msft query, which could be nice, and there are posts from just a couple of years ago where using ?'s work if its in the predicate, though in ssdt, I think the ?'s work everywhere.  Hard to say what' the current best practice.  It changes every year, presumable to keep people in employment.

1 ACCEPTED SOLUTION

@Ffitzpatrick47,

 

I didn't see any other way. You may create a support ticket.

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

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Ffitzpatrick47,

 

You could also take a look at Text.Format function.

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

Yes, I'm sure I can format the date to a postgre date string. My real question was on query folding and a more official parameter push down method. Do you know?

@Ffitzpatrick47,

 

I didn't see any other way. You may create a support ticket.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.