'Airflow MSSQL use parameters for insert statement
I read that using parameters in an INSERT statement is a lot safer for injections. So with the cursor I would do this:
cursor.execute("INSERT INTO table VALUES (%s, %s, %s)", (var1, var2, var3))
Can this also be done in Airflow instead of the following? :
populate_user_table = MsSqlOperator(
task_id='populate_user_table',
mssql_conn_id='airflow_mssql',
sql=r"""
INSERT INTO Users (username, description)
VALUES ( var1, var2);
""")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
