from typing import Optional
from datetime import datetime

from sqlalchemy import DateTime, String
from sqlalchemy.sql.schema import Column
from sqlmodel import Field, SQLModel

class Test(SQLModel, table=True): 
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str

class DataStorage(SQLModel, table=True):

    test_id: int = Field(foreign_key="test.id")
    distance: int
    created: Optional[datetime] = Field(
        default=None,
        sa_column=Column("created", DateTime),
    )





sqlalchemy.sql.schema.Column sqlmodel.Field
[((237, 274), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'primary_key': '(True)'}), '(default=None, primary_key=True)\n', (242, 274), False, 'from sqlmodel import Field, SQLModel\n'), ((351, 379), 'sqlmodel.Field', 'Field', ([], {'foreign_key': '"""test.id"""'}), "(foreign_key='test.id')\n", (356, 379), False, 'from sqlmodel import Field, SQLModel\n'), ((479, 506), 'sqlalchemy.sql.schema.Column', 'Column', (['"""created"""', 'DateTime'], {}), "('created', DateTime)\n", (485, 506), False, 'from sqlalchemy.sql.schema import Column\n')]