- changed status to wontfix
Float() parameters don't enforce proper database column definition with MySQL
Issue #2258
resolved
I'm using flask-sqlalchemy and its developer said that the following is a SQLAlchemy issue:
If I do something like: lat = db.Column(db.Float(precision=16, scale=6), nullable=False)
and then I use MySQL's SHOW CREATE TABLE tablename .. I get the following: lat float NOT NULL,
Which shows that the precision and scale parameters are ineffective.
Comments (5)
-
repo owner -
repo owner - changed status to open
- removed status
the Float type should not be accepting and ignoring kwargs here.
-
repo owner -
repo owner Also can't reproduce exactly your description - "precision" is correctly interpreted by the MySQL dialect when specified on the base
Float
type:from sqlalchemy import Float, Table, MetaData, Column from sqlalchemy.schema import CreateTable f = Float(precision=5, scale=10) from sqlalchemy.dialects import mysql print f.compile(dialect=mysql.dialect()) t = Table('foo', MetaData(), Column('x', Float(precision=5, scale=10))) print CreateTable(t) print CreateTable(t).compile(dialect=mysql.dialect())
output:
FLOAT(5) CREATE TABLE foo ( x FLOAT ) CREATE TABLE foo ( x FLOAT(5) )
-
repo owner - removed milestone
Removing milestone: 0.7.3 (automated comment)
- Log in to comment
sorry, not a bug, use :