The following code saves the current time using the Time type
import datetime
from sqlalchemy import (Text, Time)
class Tel(Base):
__tablename__ = 'tel'
no = Column(Text)
updated_at = Column(Time, default=datetime.datetime.now().time())
I don't feel like I'm not good at handling time ...
If you look at "A type for ~" on the page here, you can see the mapping between SQLAlchemy type and Python type. I understand.
Recommended Posts