title: Flask-SQLAlchemy declarative and MySQL specific data types
body: <p>I have an already existing MySQL DB with many columns defined with MySQL specific column types (MEDIUMINT, TINYINT to mention a few), and even if the column type belongs to a standard SQL data type, sometimes is declared as unsigned.</p>
  
  <p>Now I'm writing a Flask app to provide an API to access DB in various ways.
  Using plain SQLAlchemy, I would import specific data types definitions from sqlalchemy.dialects.mysql, like:</p>
  
  <pre><code>from sqlalchemy import Column
  from sqlalchemy.ext.declarative import declarative_base
  from sqlalchemy.dialects.mysql import MEDIUMINT, TINYINT
  
  Base = declarative_base()
  
  class User(Base):
      id = Column(MEDIUMINT(unsigned=True), primary_key=True)
  </code></pre>
  
  <p>But I was told to use Flask-SQLAlchemy, so I'm declaring my tables like</p>
  
  <pre><code>from flask.ext.sqlalchemy import SQLAlchemy
  db = SQLAlchemy(app)
  
  class User(db.Model):
      id = db.Column(db.Integer**(???)**, primary_key=True)
  </code></pre>
  
  <p>How can I tell Flask-SQLAlchemy that the column id is a MySQL MEDIUMINT and that is unsigned? Can I pass, as the first argument to "db.Column" a data type definition imported not from "db.Something" but from sqlalchemy.dialects.mysql, and that would be a good practice (doesn't seem to me)?</p>
  
  <p>Thank you ;)</p>