[Sqlalchemy-tickets] Issue #3159: cant insert NULL into a json column if column is present (zzzeek/
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2014-08-07 14:13:27
|
New issue 3159: cant insert NULL into a json column if column is present https://bitbucket.org/zzzeek/sqlalchemy/issue/3159/cant-insert-null-into-a-json-column-if Mike Bayer: the serializer grabs None if it is present. for backwards compat we should support null() which currently also blows up: ``` #!python from sqlalchemy import create_engine, Column, Table, MetaData, func, select, null from sqlalchemy.dialects.postgresql import JSON e = create_engine("postgresql://scott:tiger@localhost/test", echo='debug') c = e.connect() t = c.begin() table = Table('json_test', MetaData(), Column('data', JSON)) table.create(c) c.execute(table.insert(), [{"data": {"foo": "bar"}}, {"data": None}]) assert c.scalar( select([func.count('*')]). select_from(table).where(table.c.data == null())) # probable workaround, also fails to invoke #c.execute(table.insert(), [{"data": {"foo": "bar"}}, {"data": null()}]) ``` |