I have a User class:
class User(db.Model, UserMixin):
"""
ORM Class: An object that represents a user
"""
__tablename__ = "Users"
id = db.Column('id', db.Integer, primary_key=True)
email = db.Column('email', db.String(128), unique=True)
passwordhash = db.Column('passwordhash', db.String(128))
def __init__(self, email, password):
self.email = email
self.passwordhash = generate_password_hash(password)
logging.info("creating user with email and pw:" + email + " " + password)
And when I create a new user:
newuser = User(email="test@email.com", password="hunter2")
db.session.add(newuser)
I get a KeyError: 140736669950912
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/_collections.py", line 988, in __call__
return self.registry[key]
KeyError: 140736669950912
Where is this number coming from? I am also getting another error during the handling of that KeyError which is a RuntimeError: application not registered on db instance and no applicationbound to current context