Reputation: 37
Azure Data Factory Pipeline is getting the SQL query stored in a database table. Eg. Query:
Select * from employees where first_name = 'Sam' and last_name = 'mathew'
I need to update the query in such a way that fname
and lname
will be a parameter in the azure data factory pipeline say
pipeline().parameters.fname
and pipeline().parameters.lname
How will the query be modified to use these pipeline parameters in SQL query?
Note: SQL Query is stored in database table. The pipeline will fetch the SQL Query in Copy Data Pipeline Step
Upvotes: 1
Views: 920
Reputation: 11284
As suggested by @Nandan, you have to do this by creating a stored procedure in the database and pass the pipeline parameters in copy activity.
Please follow the demonstration below for that:
Here I am copying the selected data from query to a csv file in blob. You can copy wherever you want.
I am creating stored procedure in the database like below with fname
and lname
as parameters and use concat()
in sql.
create or alter procedure dbo.proc1 @fname nvarchar(32),@lname nvarchar(32)
as
begin
select concat(firstname,' ',lastname) as employee_name from [dbo].[employees] where employees.firstname=@fname and
employees.lastname=@lname;
end
fname
and lname
with default value like below.fname
and lname
parameter values.My Output:
Upvotes: 1