title: Check if a table column exists in the database using SQLAlchemy and Alembic
body: <p>I'm using Alembic as migration tool and I'm launching the following pseudo script on an already updated database (no revision entries for Alembic, the database schema is just up to date).</p>
  
  <pre class="lang-py prettyprint-override"><code>revision = '1067fd2d11c8'
  down_revision = None
  
  from alembic import op
  import sqlalchemy as sa
  
  
  def upgrade():
      op.add_column('box', sa.Column('has_data', sa.Boolean, server_default='0'))
  
  
  def downgrade():
      pass
  </code></pre>
  
  <p>It gives me the following error only with PostgreSQL behind (it's all good with MySQL):</p>
  
  <pre><code>INFO  [alembic.migration] Context impl PostgresqlImpl.
  INFO  [alembic.migration] Will assume transactional DDL.
  INFO  [root] (ProgrammingError) ERREUR:  la colonne « has_data » de la relation « box » existe déjà
  </code></pre>
  
  <p>Last line means the column <code>has_data</code> already exists.</p>
  
  <p>I want to check that the column exists before <code>op.add_column</code>.</p>