PyDAL issues with json

17 views
Skip to first unread message

Maurice Waka

unread,
Apr 5, 2026, 9:00:48 AM (8 days ago) Apr 5
to py4web

When I used PostgreSQL (including NeonDB), and inserting into a Field('images', 'json') column, I noted tht it fails even when passing a properly serialized JSON string via json.dumps().

Instead of inserting the correct JSON value (e.g. ["images/pets.jpg"]), pyDAL inserts a corrupted string containing its internal list separator ('||'), resulting in:

SQL
invalid input syntax for type json
DETAIL: Token "|" is invalid.
CONTEXT: JSON data, line 1: |...

what I did

  1. Define table with PostgreSQL:

    Field('images', 'json')
  2. In an @action, do:
    Python
    images_value = json.dumps(["images/test.jpg"])
    db.mytable.insert(..., images=images_value)
Reply all
Reply to author
Forward
0 new messages