title: Avoid Parameter Binding When Executing Query with SQLAlchemy
body: <p>I am using SQLALchemy to execute queries on Teradata. One of the queries I execute is a DDL statement to replace a stored procedure:</p>
  
  <pre><code>REPLACE PROCEDURE DEV_MIGRATION_TOOL.UNIT_TEST_NEW_STORED_PROCEDURE()
  UNIT_TEST_NEW_STORED_PROCEDURE:
  BEGIN
      DECLARE V_VAR VARCHAR(50);
      SELECT 'Hello World!'
      INTO :V_VAR;
  END;
  </code></pre>
  
  <p>This SQL statement is assigned to a variable <code>query</code> and is executed by SQLALchemy with the session execute method:</p>
  
  <pre><code>def execute_sql_statement(self, query):
      """Generic method to execute a SQL statement on target environment."""
      self.target_environment.db_session.execute(query)
      self.target_environment.db_session.commit()
  </code></pre>
  
  <p>The problem I have it that SQLAlchemy assumes the <code>:V_VAR</code> variable is a parameter which should be supplied with a dictionary. See documentation here: <a href="http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.execute" rel="noreferrer">http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.execute</a></p>
  
  <pre><code>result = session.execute("SELECT * FROM user WHERE id=:param", {"param":5})
  </code></pre>
  
  <p>In the current configuration, it triggers the error message:</p>
  
  <blockquote>
    <p>2018-04-18 19:09:27,874 - migration_script - INFO - Execute object DDL
    statement on UAT environment. 2018-04-18 19:09:27,875 -
    migration_script - ERROR - (sqlalchemy.exc.InvalidRequestError) <strong>A
    value is required for bind parameter 'V_VAR'</strong> [SQL:
    "()\rUNIT_TEST_NEW_STORED_PROCEDURE:\rBEGIN\r    DECLARE V_VAR
    VARCHAR(50);\r    SELECT 'Hello World!'\r    INTO ?;\rEND;"]
    [parameters: [{}]]</p>
  </blockquote>
  
  <p>Would you know a way to avoid this error message so that my DDL statement above is executed without error?</p>