Re: [sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-21 Thread Nikola Radovanovic
Many thanks - it is much clearer now! Best regards On Tuesday, September 21, 2021 at 5:25:41 PM UTC+2 Mike Bayer wrote: > > > On Tue, Sep 21, 2021, at 10:41 AM, Nikola Radovanovic wrote: > > Thank you. > > Maybe I did not explain well (English is not my first language): when I > declare a

Re: [sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-21 Thread Mike Bayer
On Tue, Sep 21, 2021, at 10:41 AM, Nikola Radovanovic wrote: > Thank you. > > Maybe I did not explain well (English is not my first language): when I > declare a dataclass to serve as business model (so something passed around > the code, between libraries, layers, frameworks, etc.) - I

Re: [sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-21 Thread Nikola Radovanovic
Thank you. Maybe I did not explain well (English is not my first language): when I declare a dataclass to serve as business model (so something passed around the code, between libraries, layers, frameworks, etc.) - I don't want any ORM stuff in it. No matter if it is hidden in

Re: [sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-21 Thread Mike Bayer
On Mon, Sep 20, 2021, at 11:40 PM, Nikola Radovanovic wrote: > Thank you, > I am reading Architecture Patterns with Python > and trying to > find a way to refactor our code to become maintainable. However I noticed > that even

Re: [sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-20 Thread Nikola Radovanovic
Thank you, I am reading Architecture Patterns with Python and trying to find a way to refactor our code to become maintainable. However I noticed that even with mapped dataclass there are problems like the one mentioned here

Re: [sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-20 Thread Mike Bayer
On Mon, Sep 20, 2021, at 5:04 AM, Nikola Radovanovic wrote: > > Hi, > When decoupling business from ORM model, dataclass passed to SA's imperative > mapper *map_imperatively* will receive SA's internals like for example > *_sa_instance_state* and *_sa_class_manager*. > > I am wondering, what

[sqlalchemy] Decoupling business and ORM model using dataclass(es)

2021-09-20 Thread Nikola Radovanovic
Hi, When decoupling business from ORM model, dataclass passed to SA's imperative mapper *map_imperatively* will receive SA's internals like for example *_sa_instance_state* and *_sa_class_manager*. I am wondering, what would be the best way to have "pure" dataclass, without SA internals?