I hope you can forgive that I've been allowing you to figure this out
on your own as the emails here seem to be more of glimpses of an
in-progress situation rather than something those of us who are
outside of your project can easily engage within, if you are stuck on
something is there any chance you can provide a very succinct and
minimal Python script that illustrates the specific issue all at once
in a runnable format?   I see you are using things like LATERAL which
are very sophisticated Postgresql features.

On Mon, May 20, 2019 at 9:28 AM Scheck David <[email protected]> wrote:
>
> Ok I just identified the issue. It seems that there is a conflict between 2 
> subqueries :
>
> in my model.I have this :
>     statussen = relationship(
>         "PersoonStatus",
>         order_by="desc(PersoonStatus.status_datum)",
>         backref='persoon',
>         cascade='all, delete, delete-orphan',
>         lazy='subquery'
>     )
>
> and if I do this query :
>
>         last_statuses = aliased(
>                             statussen_table_name,
>                             self.session.query(
>                                 getattr(statussen_table_name, issue_id_field),
>                                  statussen_table_name.status_id)\
>                             .join(Status).order_by(Status.datum.desc())\
>                             .limit(1).subquery().lateral())
>
> there is a conflict between this 2 subqueries who target the same table.
>
> Is there a workaround to prevent this conflict?
>
> any idea?
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/61df1e98-8475-4d3a-a21b-20aff412d4fa%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CA%2BRjkXEgT9Zg8xkFexO7kthBrWzxtYW74xnOifk-3b9CMgsFQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to