Skip to content

Commit 5dc18c3

Browse files
committed
Use JSONB for event_log payload on PostgreSQL
JSON type doesn't support jsonb_set or efficient indexing. Use with_variant(JSONB(), 'postgresql') so Postgres gets JSONB while other databases keep JSON.
1 parent 74c9ead commit 5dc18c3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ingestify/infra/event_log/tables.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from sqlalchemy import BigInteger, Column, Integer, JSON, MetaData, String, Table
1+
from sqlalchemy import BigInteger, Column, Integer, MetaData, String, Table
2+
from sqlalchemy.dialects.postgresql import JSONB
3+
from sqlalchemy.types import JSON
24

35
from ingestify.infra.store.dataset.sqlalchemy.tables import TZDateTime
46

@@ -18,7 +20,7 @@ def get_tables(table_prefix: str = ""):
1820
autoincrement=True,
1921
),
2022
Column("event_type", String(255), nullable=False),
21-
Column("payload_json", JSON, nullable=False),
23+
Column("payload_json", JSON().with_variant(JSONB(), "postgresql"), nullable=False),
2224
Column("source", String(255)),
2325
Column("dataset_id", String(255)),
2426
Column("created_at", TZDateTime(6)),

0 commit comments

Comments
 (0)