dataclass-wizard
dataclass-wizard copied to clipboard
Datetime default sql value cant be parsed
- Dataclass Wizard version: 0.22.2
- Python version: 3.9
- Operating System: Osx
Description
I have sqllite db with model:
@dataclass
class Account(db.Model):
id: int
login: str
time_added: datetime
__tablename__ = 'accounts'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
login = db.Column(db.String(length=100), nullable=True)
time_added = db.Column(db.DateTime, default=datetime.now)
What I Did
DumpMeta(key_transform='SNAKE').bind_to(Account)
my_dict = asdict(self)
print(my_dict)
{'id': 1, 'login': '', 'time_added': '2022-10-22T18:38:59.950548'}
Why time_added cant be parsed and returns as string?
I want to set custom format like '%d.%m %H:%M'. How is it possible to do it?