for the "postgresql JSON function that wants to be in the FROM clause", there is a way to do this with plain Core API but it generates a subquery (that's here: http://docs.sqlalchemy.org/en/rel_1_0/core/tutorial.html#functions , scroll down a little in that section), but also I've been pointing people to an interim solution that has all of PG's functions in mind, that is here: https://bitbucket.org/zzzeek/sqlalchemy/issues/3566/figure-out-how-to-support-all-of-pgs#comment-22842678 . It includes two examples to get you started.

On 03/21/2016 06:38 AM, Andy S wrote:
I'm stuck with the need to generate a query of the form like:

|
SELECT
  a.id,
  b.name,
  jr.*
FROM
  a,b outer join jsonb_populate_recordset(b.jrs)asjr(bid numeric,name
varchar)on (TRUE)
WHERE
  a.id =b.a_id
|

First, it's not clear to me how to construct a dynamically defined
RECORD as 'jr(bid numeric, name varchar)' so 'jr' becomes a table name
that could be referenced later on

Then it's not clear to me how to construct a table-like object of a
function call that one can reference in query() by it's name ('jr' in
this case).


Is it possible with SQLAlchemy?

--
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
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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.

Reply via email to