Passing SQL file as a parameter to source dataset in ADF

Purushottam Uppu 21 Reputation points
2021-06-30T09:26:45.06+00:00

Hi,

I am using a SQL query to connect to Oracle database in my source dataset. But the query is a dynamic in nature and any changes to the query would end up modifying the query in source dataset and publish.

To avoid this, we wanted to place the query in a .sql file as a file and call this during ADF execution.

Is it possible? Appreciate your response.

Thanks
Purushottam

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,651 questions
{count} votes

Accepted answer
  1. ShaikMaheer-MSFT 37,971 Reputation points Microsoft Employee
    2021-07-02T07:21:22.683+00:00

    Hi @Purushottam Uppu ,

    Welcome to Microsoft Q&A Platform. Thank you for posting your query here.

    Please check below detailed explanation of implementing same.

    Here, I am having my SQL query in "Query.sql" file on blob storage. Reading data from that "Query.sql" file using lookup activity. Using lookup activity output in copy activity query field dynamically.

    Step1: Query.sql file in my blob storage
    111263-fileinblobstorage.gif

    Step2: Lookup activity in pipeline to get our SQL query from file on blob
    111257-lookupactivity.gif

    Step3: Lookup activity output json shows our SQL query from file.
    111282-outputjson.gif

    Step4: Copy Activity. In Source using query option and dynamically running our query from lookup activity output.
    111217-copyactivity.gif

    Hope this will help. Thank you

    --------------------------------------

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification

0 additional answers

Sort by: Most helpful