from dataclasses import dataclass from tortoise.models import Model from tortoise import fields @dataclass class User(Model): id = fields.IntField(pk=True) username = fields.CharField(max_length=50, unique=True) email = fields.CharField(max_length=100, unique=True) @dataclass class Product(Model): id = fields.IntField(pk=True) name = fields.CharField(max_length=100) price = fields.DecimalField(max_digits=10, decimal_places=2)