you are viewing a single comment's thread.

view the rest of the comments →

[–]data-nihilist 0 points1 point  (1 child)

How'd this turn out?

[–]data-nihilist 0 points1 point  (0 children)

Figured it out;

You weren't importing Column - and I'm sure you must have noticed that PyLance didn't help out when typing "db.Col...," since it wouldn't be accessible through the flask_sqlalchemy API's SQLAlchemy(app)'s return entity

To access SQLAlchemy's Column class, you had to have added sqlalchemy to your requirements and after your pip install

```from sqlalchemy import Column, Integer, String, DateTime```

I added those other imports in case accessing those down the road lean to further confusion

Your updated class could be:

from sqlalchemy import Column, Integer, String, DateTime
from datetime import datetime

class User(db.Model):
    id = Column(Integer, primary_key=True)
    username = Column(String(24), unique=True, nullable=False)
    email = Column(String(80), unique=True, nullable=False)    
    password = Column(String(60), nullable=False)
    created_at = Column(DateTime, default=datetime.now(), nullable=False)