Firstly i'm new to coding so go easy please.
I have a web flask app with sqlalchemy using mysql.
I have the db code working fine but in one column i wish to use float. However after declaring my db.column as float or even numeric as reading up suggests the data is always rounded up or down.
I wish to save as is. IE always keeps the decimal point if there is one
i have this as my class:
`class crypto_buys_tb(db.Model): # database table for crypto buys id = db.Column(db.Integer, primary_key=True) crypto_name = db.Column(db.String(100)) # these are the db columns and datatypes for columns crypto_price = db.Column(db.FLOAT) amount_paid = db.Column(db.Integer)
def __init__(self, crypto_name, crypto_price, amount_paid): # when a class instance is created, params needed
self.crypto_name = crypto_name
self.crypto_price = crypto_price
self.amount_paid = amount_paid `
when entering '15.6' as the 'crypto price'
It rounds off as below
i wish to keep it as entered without rounding. IE '15.6'
thanks for your time and help
here is the output from the mysql shell: