hi,

I have the following model:

class Product(Base):
     skus = Column(ARRAY(JSON))


p = Product(skus=[{"skuPrice": "44.88", "skuStock": true, 
"aeopSKUProperty": [], "skuCode": "060314"}])

session.add(p)
t.commit()

Error comes out:
sqlalchemy.exc.InvalidRequestError: This Session's transaction has been 
rolled back due to a previous exception during flush. To begin a new 
transaction with this Session, first issue Session.rollback(). Original 
exception was: (raised as a result of Query-invoked autoflush; consider 
using a session.no_autoflush block if this flush is occuring prematurely) 
(ProgrammingError) column "skus" is of type json[] but expression is of 
type text[] ..

'INSERT INTO product (created_at, updated, skus) VALUES (%(created_at)s, 
%(updated_at)s, %(skus)s) RETURNING product.id' {'skus': ['{"skuPrice": 
"44.88", "skuStock": true, "aeopSKUProperty": [], "skuCode": "060314"}'], 
'created_at':  .... } 


it seems sqlalchemy only support array(Unicode), it convert Json into str...

any suggestion?


wenlong

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to