mehmax commented on issue #18664:
URL: https://github.com/apache/airflow/issues/18664#issuecomment-935595790


   @nikochiko 
   In oracle, schema is something different to service_name. I dont know why is 
was coded like this.
   service name is needed to connect to the database
   
   I am no oracle expert, but let me explain it in an example.
   Tables in oracle are created in a schema. To query a table you have to use 
the following syntax:
   `SELECT * FROM SCHEMA.TABLE` .
   If you set a specific schema as a current_schema with
   `ALTER SESSION SET CURRENT_SCHEMA = SCHEMA`, you do not have to specifiy it 
in the SQL Syntax anymore:
   `SELECT * FROM TABLE` .
   
   Please refer to also to this links
   
https://docs.oracle.com/cd/B28359_01/server.111/b28310/general009.htm#ADMIN02101
   how it is working in cx_Oracle
   
https://cx-oracle.readthedocs.io/en/6.4.1/connection.html#Connection.current_schema
   
   In my opinion it can be solved by adding the following lines
   
   ```
   schema = conn.schema
   ...
   conn = cx_Oracle.connect(**conn_config)
   conn.current_schema = schema
   
   ```
   or (equivalent)
   ```
   schema = conn.schema
   ...
   conn = cx_Oracle.connect(**conn_config)
   conn.execute(f"ALTER SESSION SET CURRENT_SCHEMA={ schema }")
   ```
   


-- 
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: [email protected]

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


Reply via email to