Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have setup a connection to get the data from Athena which is ofcourse via odbc connector and powerbi gateway. Now I need to get the data but I need to set parameters to control the number of records, rangestart and rangeend.
I used the following m query but I dont think its working as its ending with timeout error as I tried to fetch only 1 days data which shouldn't cross 1L record. Also Im not sure of the parameter so I need your help in fetching the data.
Hi @DivyaA
Thank you for submitting your question to the Microsoft Fabric Community Forum, and thanks to @Ahmed-Elfeel for offering helpful suggestions.
Could you let us know if the suggested solution resolved your issue?If you still need help, please share more details so we can assist you further.
Thank you.
Hi @v-karpurapud ,
The solution provided did not work for me and I've dropped the requirement as well so thank you for your support.
Hi @DivyaA
Thank you for the update. Kindly let us know if this requirement can now be considered closed, or if you would like us to continue exploring a solution for the Athena ODBC parameter setup.
Please feel free to reach out anytime if you wish to revisit this in the future or need support with an alternative approach.
Regards,
Microsoft Fabric Community Support Team.
You may close the ticket. Thanking everyone for the support
Hi @Ahmed-Elfeel ,
Thank you for the response.
I tried your query but ended with this error. Im not sure of its occurrence as I used correct field name, no shorthand form was used.
Hi @DivyaA,
This error message could be:
Incorrect Table/Column Names (Case sensitivity issues)
Parameter Data Type Mismatches (Dates not being passed correctly)
SQL Syntax Issues (Even small syntax errors can cause this)
ODBC Connection Problems (DSN configuration issues)
You can debug it by:
let
Source = Odbc.Query("dsn=your-athena-dsn", "
SELECT 1 as Test
LIMIT 1
")
in
Source
Table name in Athena?
Date column name exactly as it appears in Athena?
Data types of your date columns?
let
// First, convert parameters to text for debugging
startDate = Text.From(RangeStart),
endDate = Text.From(RangeEnd),
recordLimit = Number.ToText(DevelopmentRecords),
sqlQuery = "
SELECT *
FROM your_actual_table_name
WHERE your_actual_date_column >= CAST('" & startDate & "' AS TIMESTAMP)
AND your_actual_date_column < CAST('" & endDate & "' AS TIMESTAMP)
LIMIT " & recordLimit,
Source = Odbc.Query("dsn=your-athena-dsn", sqlQuery)
in
Source
Also here is another approach (With excplicit casting)
let
Source = Odbc.Query("dsn=your-athena-dsn", "
SELECT *
FROM your_actual_table_name
WHERE your_actual_date_column >= CAST(? AS TIMESTAMP)
AND your_actual_date_column < CAST(? AS TIMESTAMP)
LIMIT ?
", [
Text.From(RangeStart),
Text.From(RangeEnd),
DevelopmentRecords
])
in
Source
Try the basic connection test first then we can build up from there; The garbled error usually indicates a fundamental syntax or connection issue rather than just parameter problems.
Hi @DivyaA,
There is :
Syntax errors in your M code (incomplete statements and missing brackets)
Parameter data type mismatches (Dates are likely being passed as text)
Inefficient query structure
Here is Corrected M code :
let
Source = Odbc.Query("dsn=your-athena-dsn", "
SELECT *
FROM your_table_name
WHERE date_column >= ?
AND date_column < ?
LIMIT ?
", [
RangeStart, // Parameter 1
RangeEnd, // Parameter 2
DevelopmentRecords // Parameter 3
])
in
Source
Note:
Make sure your parameters are set up with correct data types:
Development (Yes): Text type, value "Yes"
Development Records: Whole Number type, value 500
Date/Time type, value 5/1/2025 12:00:00 AM (RangeStart)
Date/Time type, value 5/2/2025 12:00:00 AM (RangeEnd)
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.