klen / mixer

Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.
Other
943 stars 96 forks source link

Mixer should respect decimal presision on SQLAlchemy models #170

Open pax0r opened 2 years ago

pax0r commented 2 years ago

I have model with field defined like this: Column(sa.Numeric(precision=9, scale=3), nullable=False) and I am trying to use Mixer to put data into that model. Sometimes it tries to insert larger values than allowed by this field which results with error:

sqlalchemy.exc.DataError: Mixer (<class 'test.Model'>): (psycopg2.errors.NumericValueOutOfRange) numeric field overflow
DETAIL:  A field with precision 9, scale 3 must round to an absolute value less than 10^6.