> > > > I've yet to see an unambiguous statement of what "the raw SQL" is. If > it is this: > > select c.pk,c.mangaid,c.manga_target_pk, n.z, > (select (array_agg(unwave.restw))[0:5] as restwave from (select > (unnest(w.wavelength)/(1+n.z)) as restw from mangadatadb.wavelength as > w) as unwave) > from mangadatadb.cube as c > join mangasampledb.manga_target as m on m.pk=c.manga_target_pk > join mangasampledb.manga_target_to_nsa as t on t.manga_target_pk=m.pk > join mangasampledb.nsa as n on n.pk=t.nsa_pk > join mangadatadb.wavelength as w on w.pk=c.wavelength_pk;
> then that does not, and cannot, correspond to the Python code you are > sending. the JOINs would not be inside of the @expression, you'd have > to write them out on the outside. Yeah, that was the SQL that would be typed into psql. I know that the Python implementation is incorrect. I've been trying to sort that out. I've provided a complete example of how to render SQL extremely similar > to what you want, featuring techniques such as correlate() as well as > how to nest the queries appropriately. If at this point you aren't able > to manipulate the code to get what you want, then I'd advise not using a > hybrid for this query at all. It is extremely complicated in this > context, and unless you are deeply familiar with SQLAlchemy APIs, you > would just have a bunch of code that you can't effectively maintain. > Ok..thanks for your help. I appreciate it. -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.