On Mon, May 13, 2019 at 10:37 AM Scheck David <[email protected]> wrote:

> the problem is that I can't use SQL for this because this is a mixins that
> I use for several objects (tables) because they all have this status
> structure... yes it's quite difficult to do :
>

I don't know what it is you want to do so if you could illustrate the SQL
that resembles what you want, I'd have some idea.   If you are trying to
build a Query object, then you are working with SQL and you'd need to
understand the structure you're looking for.




>
> right now I'm on this stage, but still don't work
> self.session.query(Object).outerjoin(ObjectStatus).outerjoin(Status)\
>             .group_by(Object).with_entities(Object,
> func.max(Status.datum).label("status_datum")).subquery()
>
> self.session.query(Object).join((sub, sub.c.id == Status.id))\
>         .filter(sub.c.statustype_id > 50)
>
> Le lun. 13 mai 2019 à 16:26, Mike Bayer <[email protected]> a
> écrit :
>
>> Hi -
>>
>> I was hoping someone could jump in on this.
>>
>> do you know the SQL that you want to emit?  E.g. plain SQL string.   I
>> can help you do that part.
>>
>>
>> On Mon, May 13, 2019 at 9:11 AM Scheck David <[email protected]> wrote:
>> >
>> > I think I'm near but I can't finish :
>> >
>> > for all the structure : https://dpaste.de/fek5#L
>> >
>> > and here my query :
>> >
>> > self.session.query(Object).outerjoin(ObjectStatus).outerjoin(Status)\
>> >             .group_by(Object).with_entities(Object,
>> func.max(Status.datum).label("status_datum")).subquery()
>> >
>> > self.session.query(Object).join((sub, sub.c.id == Status.id))\
>> >         .filter(sub.c.statustype_id > 50)
>> >
>> > but status type not reachable.
>> >
>> >
>> > --
>> > 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/fe2da543-2710-4b44-9f88-e68c5e35faea%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 a topic in the
>> Google Groups "sqlalchemy" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sqlalchemy/Cju-PF7mV58/unsubscribe.
>> To unsubscribe from this group and all its topics, 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%2BRjkXF3d_pffLqFLYpSNw80E%3D_2ULhh0pTiqBG-F1dFjA9r1Q%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> With kindest regards,
>
>
> *David SCHECK*
>
> PRESIDENT/DEVELOPER
>
> [image: Signature Logo Sphax Bleu-01.png]
>
> Phone: +32 4 87 86 70 12
> Visit our website ! https://www.sphax.org
>
> --
> 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/CAOPG6scR1rWJTBN%3DEArX2buPqiVsGaPiQq4wYGU58Renqae0kA%40mail.gmail.com
> <https://groups.google.com/d/msgid/sqlalchemy/CAOPG6scR1rWJTBN%3DEArX2buPqiVsGaPiQq4wYGU58Renqae0kA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> 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%2BRjkXHLyGB73FcCowpBZ%2BoUpE2ErdDMevEHP%2BCB375yn_XnLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to