Reputation: 35
I am executing this query:
select * from schema.country where country_code='abc' and country='INDIA'
inside ADF dataflow. I am getting this query from the database so I don't want to hardcode it inside the data flow. All the data flow inputs are adding a single quotes while executing. The dataflow is failing because of parsing error.
How can I escape single quotes ?
Upvotes: 0
Views: 1871
Reputation: 11529
You can just pass your query in double quotes (""
) in the dataflow to escape single quotes.
Please go through the below 3 approaches based on your usage of query in the dataflow.
This is my sample data from database:
If you are using Query in the source of dataflow, you can give the below expression in the Expression builder.
"select * from [dbo].[country] where country_code='abc' and country_name='INDIA'"
Output Data preview:
If you want to get your query from your database, then create a stored procedure for the query and access it inside the dataflow.
My stored procedure in the database:
create or alter procedure dbo.proc2
as
begin
select * from [dbo].[country] where country_code='abc' and country_name='INDIA'
end;
Use this query inside stored procedure in the dataflow like below. You will get the same output as above.
If you are using pipeline paramter to pass query to the dataflow, then create a parameter in the dataflow with default value. Give your query in double quotes
in the pipeline parameters expression. Check the Expression check box after this.
Then give the $parameter1
in the expression builder of query and execute. Please check this SO thread to learn more it.
My csv in sink after pipeline execution in this process:
Upvotes: 4