problem description
when inserting data, username I pass 11 digits, such as 12345678901, the database only stores 1234567890, the first ten digits are intercepted by default,
my String (10) is set to 10
the environmental background of the problems and what methods you have tried
I can"t think of any good method for the time being
related codes
/ / Please paste the code text below (do not replace the code with pictures)
from port import db
class User (db.Model):
__tablename__ = "b_user"
id = db.Column(db.Integer,primary_key=True )
username = db.Column(db.String(10),unique=True,index=True, nullable=False)
password = db.Column(db.String(16))
def __init__(self,username,password):
self.username = username
self.password = password
def __repr__(self):
return "<User %r>" % self.username
def __json__(self):
return ["id", "username", "password"]
what result do you expect? What is the error message actually seen?
I expect that the insertion string is too long, need to report an exception, can not be inserted into the database, ask the bosses to give a solution! Thank you very much