Re: [sqlalchemy] Selectinload and bindparam

2021-09-10 Thread Tomas Pavlovsky
Yeah, new api is great, eg: loader_fn = self.lazy_loader_map.get(relation_attribute.prop.lazy, 'selectinload') self.opts.append(loader_fn(relation_attribute.and_(*relation_filter).options(*related.opts)) or with_loader_criteria and events you mentioned. Thanks again. Have a nice weekend.

Re: [sqlalchemy] Selectinload and bindparam

2021-09-10 Thread Mike Bayer
great, glad you were able to work that out that's a lot of new API to learn On Fri, Sep 10, 2021, at 3:39 AM, Tomas Pavlovsky wrote: > Thank you very much, > It helped me a lot, UserDefinedOption and do_orm_execute, I missed it in the > documentation > > P.S. Thank you for sqlalchemy, it's

Re: [sqlalchemy] Selectinload and bindparam

2021-09-10 Thread Tomas Pavlovsky
Thank you very much, It helped me a lot, UserDefinedOption and do_orm_execute, I missed it in the documentation P.S. Thank you for sqlalchemy, it's really helpful and thanks to nested options it's really fun to use. wtorek, 31 sierpnia 2021 o 16:41:07 UTC+2 Mike Bayer napisaƂ(a): > > this is

Re: [sqlalchemy] Selectinload and bindparam

2021-08-31 Thread Mike Bayer
this is true, the parameters can't be known to be passed along to a secondary query. the approach here would require that you make careful use of custom user options and events in order to make it work. the general event hook you would use is documented at

Re: [sqlalchemy] Selectinload and bindparam

2021-08-31 Thread Tomas Pavlovsky
Sorry, once again :) class X(Base): id: int = Column('x_id', Integer, primary_key=True, autoincrement=True) a_id: int = Column('a_id', Integer, ForeignKey('a.a_id')) a = relationship(A) s = select(A).where(A.id == 1) s = s.options(joinedload(A.b_filtered_rel)) or s =

Re: [sqlalchemy] Selectinload and bindparam

2021-08-31 Thread Tomas Pavlovsky
Hello Mike, Thank you very much for your response. I ended up with that, but i wanna ask you about this solution. class A(Base): id: int = Column('a_id', Integer, primary_key=True, autoincrement=True) #descr class B(Base): id: int = Column('b_id', Integer, primary_key=True,

Re: [sqlalchemy] Selectinload and bindparam

2021-08-30 Thread Mike Bayer
yes, you would use bindparam("some_name") in conjunction with the "and_()" feature, like options(selectinload(MyClass.foo.and_(MyClass.name == bindparam("some_name" On Mon, Aug 30, 2021, at 10:55 AM, Tomas Pavlovsky wrote: > Hello, > > is it possible in sqlalchemy arguments from

[sqlalchemy] Selectinload and bindparam

2021-08-30 Thread Tomas Pavlovsky
Hello, is it possible in sqlalchemy arguments from db.execute(query, args) to be passed to query emitted by selectinload? Thanks, Tomas -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal,