this will be fixed in https://github.com/sqlalchemy/sqlalchemy/issues/5981  
where I've reverted entirely some changes to AppenderQuery that made it work 
more in 2.0 style.  As Query is going to be present in 2.0, "dynamic" 
relationships will remain also as legacy.   They are superseded by explicit use 
of the with_parent() filtering construct.



On Thu, Feb 25, 2021, at 3:25 PM, Ahmed wrote:
> Hello,
> 
> It seems that SQLAlchemy 1.4.0b3 ignores relationship()  query_class 
> parameter. Here's the snippet that works with 1.3 but doesn't with 1.4:
> 
> class Parent(db.Model):
>     __tablename__ = "todo"
>     id = db.Column(db.Integer, primary_key=True)
>     # ... Column mappings
>     children = db.relationship("Child", backref="todo", 
> query_class=DerivedQuery, lazy="dynamic")
> 
> class Child(db.Model):
>     __tablename__ = "todo"
>     # ... Column mappings
>     parent_id = db.Column(db.Integer, db.ForeignKey("todo.id"))
> 
> assert isinstance(p.children, DerivedQuery)
> 
> In 1.4, children attribute is always an instance of AppenderQuery regardless 
> of the query_class value. I might have missed something above though.
> 
> 
> 

> -- 
> SQLAlchemy - 
> The Python SQL Toolkit and Object Relational Mapper
>  
> http://www.sqlalchemy.org/
>  
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/4454277c-b3a1-484e-b0e5-aef3e72eeb01n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/4454277c-b3a1-484e-b0e5-aef3e72eeb01n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/38ad4e7a-cf4d-4688-b21b-e35c60d98a62%40www.fastmail.com.

Reply via email to