Re: [sqlalchemy] Returning Postgres JSON view as JSON string without serialization

2021-10-30 Thread Stephan Hügel
Thanks Mike, wrapping the view declaration with ()::TEXT worked perfectly, but good to know I can do it from SQLA at load time if need be. On Saturday 30 October 2021 at 02:17:49 UTC+1 Mike Bayer wrote: > oh also, if this is a view, much easier, just put the CAST to TEXT in your > CREATE VIEW

Re: [sqlalchemy] Returning Postgres JSON view as JSON string without serialization

2021-10-29 Thread Mike Bayer
oh also, if this is a view, much easier, just put the CAST to TEXT in your CREATE VIEW statement. that way you will definitely get strings back and nothing json related will kick in client side. On Fri, Oct 29, 2021, at 9:16 PM, Mike Bayer wrote: > psycopg2 driver (if that's what you're

Re: [sqlalchemy] Returning Postgres JSON view as JSON string without serialization

2021-10-29 Thread Mike Bayer
psycopg2 driver (if that's what you're using) jumps in to do the JSON so if you dont want json you need to cast as a string, like cast(table.c.json_col, String). if you are using a Table with autoload you'd want to override this type using the technique detailed at