locked
Power Query HTTP timeout setting RRS feed

  • Question

  • Hi, I am using PowerQuery (using an M script) to make a HTTP Rest API request that sometimes takes 4-5 minutes to complete. However I get an HTTP connection timeout after 100 seconds (which I guess is the default timeout value in PowerQuery). Is there a way in PowerQuery (I am using version 2.14.3722) to override this default timeout to a larger value?

    Thanks!

    Tuesday, September 2, 2014 6:13 PM

Answers

  • If you're using Web.Contents, you can pass in the timeout as part of the options parameter. For example, to set the timeout to five minutes, you could pass:

    = Web.Contents("http://bing.com/", [Timeout=#duration(0, 0, 5, 0)])

    Ehren

    Tuesday, September 2, 2014 6:57 PM

All replies

  • If you're using Web.Contents, you can pass in the timeout as part of the options parameter. For example, to set the timeout to five minutes, you could pass:

    = Web.Contents("http://bing.com/", [Timeout=#duration(0, 0, 5, 0)])

    Ehren

    Tuesday, September 2, 2014 6:57 PM
  • Thanks, that worked perfectly!
    Wednesday, September 3, 2014 4:58 PM
  • Hi Ehren,

    I'm facing the same problem but with SQL Server data source. The query is taking long time as it involves aggregating very large table.

    From Power Query advanced editor:

    let

       Source = Sql.Database( Server name , Database name , [Query])

       # the rest of the steps ...

    I refered to this page: Here , I tried to add CommandTimeout=0 after the query, but i'm getting an error message that the Sql.Database can take 2 or 3 arguments only, and I provided 4 arguemtns. 

    Is there anyway to set timeout to 0 (unlimited)?

    Thanks,

    Alaeddin

    Wednesday, September 2, 2015 7:41 AM
  • Try this:

    Sql.Database("server", "database", [Query="...", CommandTimeout=#duration(0, 0, 0, 0)])

    Ehren

    • Proposed as answer by Alaeddin Badran Thursday, September 3, 2015 8:02 AM
    Wednesday, September 2, 2015 5:26 PM
  • Hi Ehren,

    I tried (0,0,0,0), but I got the same  Timeout expired error, I tried to change it to 5 hours (0,5,0,0), and that solved the problem.

    Thank you so much :)

    Alaeddin

    Thursday, September 3, 2015 8:02 AM