jsonb

psycopg3 inserting dict into JSONB field

psycopg3 inserting dict into JSONB field Question: I have a table with a JSONB field and would like to insert into it using a named dict like so: sql = "INSERT INTO tbl (id, json_fld) VALUES (%(id)s, %(json_fld)s)" conn.execute(sql, {‘id’:1, ‘json_fld’: {‘a’:1,’b’:false, ‘c’: ‘yes’}}); I tried the answers in this question but those all apply …

Total answers: 2

In Django 1.9, what's the convention for using JSONField (native postgres jsonb)?

In Django 1.9, what's the convention for using JSONField (native postgres jsonb)? Question: Django highly suggests not to use null=True for CharField and TextField string-based fields in order not to have two possible values for “no data” (assuming you’re allowing empty strings with blank=True). This makes total sense to me and I do this in …

Total answers: 2