1
rows = [{"id": 1, "json_value": [{"key": "value"}, {"key2": "value2"}]}, {"id": 2, "json_column": None}] 
insert_query = table.insert().values(rows)
connection.execute(insert_query)

Doing this will have "null" (String) entered to the row where id=2. Rather than the NULL type.

Is there any way to properly do multiple row insert where value of some JSON columns is NULL?

2
  • 1
    Sounds like SQLAlchemy's doing something wrong there. None should correspond to json null not "null" and thus to SQL NULL. Commented Aug 7, 2014 at 7:16
  • It also seems so to me. Just trying to find out if there is any other solution than adding an issue to the SQLAlchemy BitBucket. Commented Aug 7, 2014 at 8:12

1 Answer 1

1

The issue was a bug and has been fixed by the SQLAlchemy project maintainer.

Details here: https://groups.google.com/forum/#!topic/sqlalchemy/Bu4lJ18Gsa8

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.