kaxil commented on issue #9606:
URL: https://github.com/apache/airflow/issues/9606#issuecomment-845192785


   > Hello, I am using airflow 2.0.2, I am trying the following code, and it 
gives me this error. I have calling the function get_activated_sources from 
python operator. I am trying to pass the values to the next sql fille.
   > 
   > Not sure if it's normal in airflow 2.0.2.
   > 
   > def get_activated_sources():
   > 
   > ```
   >     
   >     PostgreConn = PostgresHook(postgres_conn_id='redshift', 
schema='reports')
   >     db_conn = PostgreConn.get_conn()
   >     cursor = db_conn.cursor()
   >     cursor.execute("SELECT id_pais, nombre, codigo, paisplataforma, 
pais_longitud, pais_latitud, nombre_eng FROM mstr_new.dw_lu_pais;")
   >    
   >     return cursor
   > ```
   > 
   > **Error**
   > `[2021-05-20 07:04:27,350] {xcom.py:237} ERROR - Could not serialize the 
XCom value into JSON. If you are using pickles instead of JSON for XCom, then 
you need to enable pickle support for XCom in your airflow config.`
   
   @maryampashmi  "cursos" will not contain the return values after running the 
SQL query. You could use `PostgresHook. get_records()` function
   
   
https://github.com/apache/airflow/blob/733bec9a04ab718a0f6289d93f4e2e4ea3e03d54/airflow/hooks/dbapi.py#L119-L135


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to