This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new fedfaa703e5 Use `JSONB` type for `XCom.value` column in PostgreSQL 
(#44290)
fedfaa703e5 is described below

commit fedfaa703e51e6857a0478e0dadc498c5f6106bc
Author: Kaxil Naik <[email protected]>
AuthorDate: Fri Nov 22 20:42:03 2024 +0000

    Use `JSONB` type for `XCom.value` column in PostgreSQL (#44290)
    
    `JSONB` is more efficient, we already use that in migration, this makes it 
consistent when DB tables are created from ORM.
---
 airflow/models/xcom.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/airflow/models/xcom.py b/airflow/models/xcom.py
index 45208e353bd..5b6f83f4d59 100644
--- a/airflow/models/xcom.py
+++ b/airflow/models/xcom.py
@@ -34,6 +34,7 @@ from sqlalchemy import (
     select,
     text,
 )
+from sqlalchemy.dialects import postgresql
 from sqlalchemy.ext.associationproxy import association_proxy
 from sqlalchemy.orm import Query, reconstructor, relationship
 
@@ -79,7 +80,7 @@ class BaseXCom(TaskInstanceDependencies, LoggingMixin):
     dag_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
     run_id = Column(String(ID_LEN, **COLLATION_ARGS), nullable=False)
 
-    value = Column(JSON)
+    value = Column(JSON().with_variant(postgresql.JSONB, "postgresql"))
     timestamp = Column(UtcDateTime, default=timezone.utcnow, nullable=False)
 
     __table_args__ = (

Reply via email to