You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/08/21 09:23:06 UTC

[GitHub] [airflow] hai-nv commented on pull request #23971: Unify DbApiHook.run() method with the methods which override it

hai-nv commented on PR #23971:
URL: https://github.com/apache/airflow/pull/23971#issuecomment-1221506736

   > Hi @potiuk and @kazanzhy , I added the package apache-airflow-providers-common-sql==1.1.0, but same errors continue,
   > 
   > ![image](https://user-images.githubusercontent.com/226773/185762143-4f96e425-7eda-4140-a281-e096cc7d3148.png)
   > 
   > Log
   > 
   > ```
   > [2022-08-20, 14:58:14 ] {sql.py:315} INFO - Running statement: DECLARE
   >     v_sql LONG;
   > BEGIN
   >     v_sql := '
   > create table usr_bi_cgj.dim_tarefa
   > (
   >     id_tarefa   NUMBER(22) not null primary key,
   >     ds_tarefa   VARCHAR2(4000) not NULL
   > );
   > ';
   >     EXECUTE IMMEDIATE v_sql;
   >     COMMIT;
   >     EXCEPTION
   >         WHEN OTHERS
   >         THEN EXECUTE IMMEDIATE 'TRUNCATE TABLE usr_bi_cgj.dim_tarefa';
   >     COMMIT;
   > END, parameters: None
   > [2022-08-20, 14:58:14 ] {taskinstance.py:1909} ERROR - Task failed with exception
   > Traceback (most recent call last):
   >   File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/oracle/operators/oracle.py", line 69, in execute
   >     hook.run(self.sql, autocommit=self.autocommit, parameters=self.parameters)
   >   File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/common/sql/hooks/sql.py", line 295, in run
   >     self._run_command(cur, sql_statement, parameters)
   >   File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/common/sql/hooks/sql.py", line 320, in _run_command
   >     cur.execute(sql_statement)
   >   File "/home/airflow/.local/lib/python3.7/site-packages/oracledb/cursor.py", line 378, in execute
   >     impl.execute(self)
   >   File "src/oracledb/impl/thin/cursor.pyx", line 121, in oracledb.thin_impl.ThinCursorImpl.execute
   >   File "src/oracledb/impl/thin/protocol.pyx", line 375, in oracledb.thin_impl.Protocol._process_single_message
   >   File "src/oracledb/impl/thin/protocol.pyx", line 376, in oracledb.thin_impl.Protocol._process_single_message
   >   File "src/oracledb/impl/thin/protocol.pyx", line 369, in oracledb.thin_impl.Protocol._process_message
   > oracledb.exceptions.DatabaseError: ORA-06550: linha 17, coluna 3:
   > PLS-00103: Encontrado o símbolo "end-of-file" quando um dos seguintes símbolos era esperado:
   > 
   >    ; <um identificador>
   >    <um identificador delimitado por aspas duplas>
   > O símbolo ";" foi substituído por "end-of-file" para continuar.
   > ```
   
   Have you try to remove ';' inside dynamic query? 
   From
   v_sql := '
   create table usr_bi_cgj.dim_tarefa
   (
       id_tarefa   NUMBER(22) not null primary key,
       ds_tarefa   VARCHAR2(4000) not NULL
   **);**
   ';
   To 
   v_sql := '
   create table usr_bi_cgj.dim_tarefa
   (
       id_tarefa   NUMBER(22) not null primary key,
       ds_tarefa   VARCHAR2(4000) not NULL
   )
   ';


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org