Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To utilize string interpolation for generating a query on ADF, the following method can be used:

  1. Define the query string with placeholders to be replaced with specific values:
queryString = "SELECT * FROM table WHERE date >= '{startDate}' AND date <= '{endDate}'"
  1. Define parameters that will replace the placeholders:
parameters = {
    "startDate": "2021-05-01",
    "endDate": "2021-05-31"
}
  1. Use Python's string interpolation to replace the placeholders with parameter values:
query = queryString.format(**parameters)

This will generate a SQL query that can be used in ADF. The resulting query will look like this:

SELECT * FROM table WHERE date >= '2021-05-01' AND date <= '2021-05-31'