Re: [sqlalchemy] jsonb_agg with an InstrumentedAttribute

2020-06-25 Thread Julien Cigar
On Thu, Jun 25, 2020 at 12:07:40PM -0400, Mike Bayer wrote: > is "question_choice" a table name? use > json_agg(literal_column("question_choice")) Thank you, it works with literal_column() :) > > > > On Thu, Jun 25, 2020, at 5:38 AM, Julien Cigar wrote: > > Hello, > > > > I'd like to use a

Re: [sqlalchemy] jsonb_agg with an InstrumentedAttribute

2020-06-25 Thread Mike Bayer
is "question_choice" a table name? use json_agg(literal_column("question_choice")) On Thu, Jun 25, 2020, at 5:38 AM, Julien Cigar wrote: > Hello, > > I'd like to use a sql.func.jsonb_agg() with the following > InstrumentedAttribute: > > orm.mapper( > Question,

[sqlalchemy] jsonb_agg with an InstrumentedAttribute

2020-06-25 Thread Julien Cigar
Hello, I'd like to use a sql.func.jsonb_agg() with the following InstrumentedAttribute: orm.mapper( Question, tables['amnesia_phc_registry.question'], properties={ 'choices': orm.relationship( Choice, back_populates='question' ), 'answers_text':