I've tried two approaches and both are not working, I searched on Google and didn't find any proper solutions. My code looks like:
intField = Column(SmallInt(), length=5)
And the error says:
Unknown arguments passed to Column: ['length']
I also tried, knowing it shouldn't work, this solution:
intField = Column(SmallInt(5))
And it does not work because this SqlAlchemy datatype doesn't accept arguments.
as database engine, so the solution here is to import mysql's own Integer type, and then specify the length I want it to be.
In the above example, I would only need to do:
from sqlalchemy.dialects import mysql
Integer = mysql.INTEGER
intField = Column(Integer(5))
But I still wonder if there is a more generic approach?