title: Raw SQL with "IF NOT EXISTS" doesn't execute
body: <p>This is my python code. It seems that if the raw SQL contains <code>IF NOT EXISTS</code>, sqlalchemy will not execute it. There is no exception thrown either.</p>
  
  <pre><code>db.execute(text(
      """
      IF NOT EXISTS ( select 1 from agent_assignment where exception_id = :exception_id )
      BEGIN
          insert into agent_assignment(exception_id, [user], work_status, insert_date, insert_user)
          values (:exception_id, :user, 'pending', :date, :insert_update_user)
      END
      ELSE
          update agent_assignment
          set 
              [user] = :user,
              update_date = :date,
              update_user = :insert_update_user
          where exception_id =  :exception_id
      """),
      exception_id = exception_id, 
      user = assignee,
      date = datetime.now(),
      insert_update_user = insert_update_user
  )
  </code></pre>
  
  <p>If I remove the <code>IF..ELSE</code> part, the SQL will execute correctly. So I guess technically it is impossible to execute the raw SQL with <code>IF..ELSE</code> or <code>EXISTS</code> being a part of the statement?</p>
  
  <p>What is the proper way to run raw SQL?</p>
  
  <p>Thanks in advance.</p>