Re: [sqlalchemy] How to force the engine to "glue" objects together the way it does when you run a query?

2018-09-28 Thread Mike Bayer
On Fri, Sep 28, 2018 at 9:41 PM seaders wrote: > > I'm writing some tests for my system, and I have all the objects that I > *would* be getting from the database, as flat json files, which I then load > up from, to SQLAlchemy files for my tests. > > I've all that working fine, but the one place

[sqlalchemy] How to force the engine to "glue" objects together the way it does when you run a query?

2018-09-28 Thread seaders
I'm writing some tests for my system, and I have all the objects that I *would* be getting from the database, as flat json files, which I then load up from, to SQLAlchemy files for my tests. I've all that working fine, but the one place I'd like to improve is "gluing" them back together /

Re: [sqlalchemy] SQLAlchemy query filter by field value in related table

2018-09-28 Thread Алексанр Платонов
Thank you very much for such a detailed answer. I am happy that everything works as it should. пятница, 21 сентября 2018 г., 19:02:43 UTC+3 пользователь Mike Bayer написал: > > On Fri, Sep 21, 2018 at 10:52 AM Алексанр Платонов > > wrote: > > > > Hi, with all due respect, I copy here the link

Re: [sqlalchemy] Use a set as collection for a many-to-many relationship

2018-09-28 Thread Mike Bayer
the exception you describe is not raised at mapping time, it's raised at collection assignment time, which would indicate the relationship you are attempting to assign towards was not defined with collection_class=set. Please provide complete detail including full MCVE and complete stack trace,

Re: [sqlalchemy] Use a set as collection for a many-to-many relationship

2018-09-28 Thread Mike Bayer
Is that the "set" python built-in? Is it possible the word "set" was redefined ? Because that is the correct usage and it does not raise that error for the "set" builtin On Fri, Sep 28, 2018, 6:55 AM wrote: > I'd like to do something like: > > > children = relationship("Child",

[sqlalchemy] Use a set as collection for a many-to-many relationship

2018-09-28 Thread rdebroiz
I'd like to do something like: children = relationship("Child", secondary=association_table, collection_class=set) But I get: *TypeError: Incompatible collection type: set is not list-like* Is there a way to achieve it or set is not compatible with many-to-many relationship? --