title: Overriding SQLAlchemy Columns for Testing
body: <p>I'm trying to override a SQLAlchemy column to have different attributes in my test DB. Basically, I have a composite primary key in all of my MySQL tables: an autoncrement BIGINT <code>id</code> and a DATETIME <code>create_time</code>. For unit testing, I want to use SQLite, but my research has led me to believe that autoincrement is not possible for this use case. Since I don't use my <code>create_time</code> column for anything other than creating a rolling partition in MySQL, I want to override the two columns in my unit tests so they are compatible with SQLite. Note: I am using the <code>Base = declarative_base()</code> route, and all my models inherit <code>Base</code> and <code>PrimaryKeyMixin</code>.</p>
  
  <p>In my models.py, I have created a mixin <code>PrimaryKeyMixin</code> that all tables inherit. All tables also inherit <code>TABLE_ARGS</code> for the <code>__table_args__</code> component. </p>
  
  <pre><code>TABLE_ARGS = {
      'mysql_engine': 'InnoDB',
      'mysql_charset': 'utf8'
  }
  
  class PrimaryKeyMixin:
      id = Column(BIGINT(unsigned=True), primary_key=True, autoincrement=True)
      create_time = Column(DATETIME, primary_key=True, default=func.now())
  </code></pre>
  
  <p>In my unit tests, I do the following:</p>
  
  <pre><code>from myapp.models import TABLE_ARGS, PrimaryKeyMixin, Column, INT, DATETIME, func
  TABLE_ARGS['sqlite_autoincrement'] = True
  PrimaryKeyMixin.id = Column(INT(unsigned=True), primary_key=True, autoincrement=True)
  PrimaryKeyMixin.create_date = Column(DATETIME, default=func.now())
  
  TEST_DB = '/tmp/myapp_test.db'
  from myapp import db
  from myapp.models import Base
  db.ENGINE = create_engine(
      'sqlite:///%s' % TEST_DB,
      encoding='utf-8',
  )
  Base.metadata.drop_all(db.ENGINE)
  Base.metadata.create_all(db.ENGINE)
  </code></pre>
  
  <p>However, when I add echo=True to the ENGINE, it still is creating a PRIMARY_KEY (id, create_time) for each table.</p>