byrman

Results 43 comments of byrman

https://github.com/tiangolo/sqlmodel/pull/256/files

Calling `commit()` will expire all objects in the session (see [docs](https://docs.sqlalchemy.org/en/14/orm/session_state_management.html#when-to-expire-or-refresh)), so `ticket` gets expired as a result of committing `mascot` and _vice versa_. Try this instead: ``` with Session(engine,...

Good question! I think it has to do with `ticket` and `group.ticket` being different objects. Apparently, a _new_ `ticket` object is created by pydantic during the parsing / validation process....

This seems to work, although I did not test is thoroughly: ``` class SQLModel1(SQLModel): metadata = MetaData() class SQLModel2(SQLModel): metadata = MetaData() ... SQLModel1.metadata.create_all(engine1) SQLModel2.metadata.create_all(engine2) ```

> Is the only way to handle multiple metadata is to extend the SQLModel class? In my experience there are often more solutions to a problem. I don't even know...

By the way, `create_all` accepts a list of tables, so you can control which tables are created where by passing different lists to this method. That might also be something...

Check https://github.com/tiangolo/sqlmodel/issues/315.

I am not sure I understand your question correctly, but here `list["Hero"]` should indeed be `List["Hero"]`. From Python 3.9 onwards, generic `list[Hero]` should work as well, I think, but that...

It seems related to this recent change: ``` class DeclarativeMeta( _DynamicAttributesType, inspection.Inspectable["Mapper[Any]"] ): metadata: MetaData registry: "RegistryType" def __init__( cls, classname: Any, bases: Any, dict_: Any, **kw: Any ) ->...

Not sure if this is a sustainable fix, I don't know how to leverage `__init_subclass__`, but adding 1 line after [here](https://github.com/tiangolo/sqlmodel/blob/main/sqlmodel/main.py#L371) makes things work again: ``` ... dict_used[rel_name] = rel_value...