So I've got a model like such and using sqlalchemy v0.9.8
class myModel(Base):
id = Column(Integer, primary_key=True)
border = Column(JSONB)
How can I query for rows that don't have a border? I've tried:
filter(myModel.border != None) #nope
filter(myModel.border != 'null') #nopefrom sqlalchemy import null
filter(myModel.border != null()) #nope
The value is apparently stored in postgres as a "JSON encoded null value"
<https://bitbucket.org/zzzeek/sqlalchemy/issue/3159/cant-insert-null-into-a-json-column-if>.
Its definitely getting serialized back to a python None when instantiated,
but I have no idea how to query against it. It looks like you can set
none_as_null on the column, i.e.:
Column(JSONB(none_as_null=True))
Which replaces the JSON encoded null with a SQL null, but that seems
strange to have to do on all columns. What am I missing here?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.