Azure Data Factory : Invalid URI: The Uri scheme is too long RRS feed

  • Question

  • I am using a Copy activity in Azure Data Factory to copy the data from Http Source to datalake. My Url contains sql query as a query param. Iam getting "Invalid URI: The Uri scheme is too long" error.

    Possible Error conditions:

    1.SQL query with more column in the select statement and date condition in the where clause- Error is thrown

    2.SQL query with more column in the select statement and string field in the where clause - No Error

    3. SQL query with less column in the select statement and date condition in the where clause - No Error

    API looks like the below one: a,b,c,d...... from table where date >= ' ' and date < ' '

    I'd appreciate any help on this.

    Wednesday, July 18, 2018 10:00 AM

All replies

  • Hello,

    Is your URI longer than 2000 characters? I am seeing references on the web for that error that suggests that is the problem.  If the endpoint you are calling supports the POST method, you may be able to get around the character limitation by putting your query in the message body.

    Friday, July 20, 2018 7:36 PM
  • Hi Jason,

    My URI is less than 2000 characters and the same uri works for string filter in where clause and not working for date filter in where clause.

    Monday, July 23, 2018 10:51 AM
  • Generally, some reserved characters in the URL will be encoded, for example, space would be encoded to %20, so the length of encoded URL will be longer than you expected.

    It might not be a good practice to enclose a sql query in a URL, you will hit some limitation of URL definition. Agree with Jason, "putting your query in the post request message body " should be a better workaround for you.

    Monday, July 23, 2018 2:57 PM
  • Hi Pinye,

    Yes. I agree with your point that my uri should not be longer. But my issue here is Iam getting response when the query is twice as long as the current query without date filter in where clause. But when i place the date with the format '2018-07-24T00:00:00.000Z' in the where clause , Iam getting the error.  

    Tuesday, July 24, 2018 11:00 AM
  • This seems to be related to the issue mentioned in the below link. Replacing `:` with `%3A` resolved the issue for me.
    Tuesday, February 26, 2019 11:26 PM
  • Hi Yogesh,

    Glad to know that your issue has resolved. And thanks for sharing the solution, which might be beneficial to other community members reading this thread. 

    Wednesday, February 27, 2019 5:27 AM