title: How to pass SQL as file with parameters to Airflow Operator
body: <p>I have an Operator in Airflow:</p>
  
  <pre><code>import_orders_op = MySqlToGoogleCloudStorageOperator(
      task_id='import_orders',
      mysql_conn_id='con1',
      google_cloud_storage_conn_id='con2',
      provide_context=True,
      sql="""SELECT * FROM orders where orderid&gt;{0}""".format(parameter),
      bucket=GCS_BUCKET_ID,
      filename=file_name,
      dag=dag) 
  </code></pre>
  
  <p>Now, the actual query I need to run is 24 rows long. I want to save it in a file and give the operator the path for the SQL file. The operator support this but I'm not sure what to do with the parameter the SQL is needed.</p>
  
  <p>Suggestions?</p>
  
  <p><strong>EDIT:
  This is my code:</strong></p>
  
  <pre><code>import_orders_op = MySqlToGoogleCloudStorageOperator(
      task_id='import_orders',
      mysql_conn_id='con1',
      google_cloud_storage_conn_id='con2',
      provide_context=True,
      templates_dict={'sql': '/home/ubuntu/airflow/.../orders_op.sql'},
      sql = '{{ templates_dict.sql }}',
      params={'last_imported_id': LAST_IMPORTED_ORDER_ID, 'table_name' :  TABLE_NAME},
      bucket=GCS_BUCKET_ID,
      filename=file_name,
      dag=dag) 
  </code></pre>
  
  <p>This gives:</p>
  
  <blockquote>
    <p>jinja2.exceptions.UndefinedError: 'templates_dict' is undefined</p>
  </blockquote>