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 2021/12/06 18:37:43 UTC
[GitHub] [airflow] mik-laj commented on a change in pull request #20072: Add method 'callproc' on Oracle hook
mik-laj commented on a change in pull request #20072:
URL: https://github.com/apache/airflow/pull/20072#discussion_r763271952
##########
File path: airflow/providers/oracle/operators/oracle.py
##########
@@ -47,19 +49,26 @@ class OracleOperator(BaseOperator):
def __init__(
self,
*,
- sql: Union[str, List[str]],
+ sql: Optional[Union[str, List[str]]] = None,
+ procedure: Optional[str] = None,
oracle_conn_id: str = 'oracle_default',
parameters: Optional[Union[Mapping, Iterable]] = None,
autocommit: bool = False,
**kwargs,
) -> None:
+ if sql is None and procedure is None:
+ raise ValueError("Must provide either 'sql' or 'procedure'")
super().__init__(**kwargs)
self.oracle_conn_id = oracle_conn_id
self.sql = sql
+ self.procedure = procedure
self.autocommit = autocommit
self.parameters = parameters
def execute(self, context) -> None:
- self.log.info('Executing: %s', self.sql)
+ self.log.info('Executing: %s', self.sql or self.procedure)
hook = OracleHook(oracle_conn_id=self.oracle_conn_id)
- hook.run(self.sql, autocommit=self.autocommit, parameters=self.parameters)
+ if self.sql:
Review comment:
I think these should be two separate operators- one for running SQL statements and one for calling procedures.
--
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