Le 07/09/2017 à 18:13, Richard PALO a écrit :
Is there any hints on how to use (if supported) the postgresql json array
support?
I'm a bit at a loss as to how to approach translating something like the
following
to python/sql getting a dictionary list appended to each returned row:
select fy.id, fy.name, fy.date_start, fy.date_stop,
( select array_to_json(array_agg(row_to_json(x)))
from ( select j.type, s.name, s.number_next, s.padding, s.prefix
from account_journal j
join account_sequence_fiscalyear s_fy on s_fy.fiscalyear_id =
fy.id
join ir_sequence s on s.id = s_fy.sequence_id
where j.sequence_id = s_fy.sequence_main_id
and j.type in ('sale', 'sale_refund', 'purchase',
'purchase_refund')
) x
) "invoice_sequences"
from account_fiscalyear fy
order by fy.id asc
even simpler with pg 9.5+ where 'array_to_json(array_agg(row_to_json(x)))' =>
'json_agg(x)' is available.
--
Richard PALO
--
You received this message because you are subscribed to the Google Groups
"python-sql" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.