Skip to content Skip to sidebar Skip to footer

Cannot Test Simple Sqlalchemy Model Dataclass: "mapper Mapped Class Could Not Assemble Any Primary Key Columns For Mapped Table"

I have a simple Python script (models.py) to create a Flask-SQLAlchemy app and a simple sqlalchemy dataclass (reference here) that looks like this: from flask import Flask from fla

Solution 1:

Try to use = instead of :

Like this:

class User(db.Model):

    __tablename__ = 'user'

    user_id = db.Column(db.Integer, primary_key=True)
    user_url = db.Column(db.String(2083), unique=True, nullable=False)
    username = db.Column(db.String(80), unique=True, nullable=False)
    avatar_url = db.Column(db.String(2083), unique=True, nullable=False)

Post a Comment for "Cannot Test Simple Sqlalchemy Model Dataclass: "mapper Mapped Class Could Not Assemble Any Primary Key Columns For Mapped Table""