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 2020/06/14 21:27:46 UTC

[GitHub] [airflow] ephraimbuddy commented on a change in pull request #9295: added mssql to oracle transfer operator

ephraimbuddy commented on a change in pull request #9295:
URL: https://github.com/apache/airflow/pull/9295#discussion_r439869177



##########
File path: airflow/contrib/operators/mssql_to_oracle_transfer.py
##########
@@ -0,0 +1,92 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from airflow.models import BaseOperator
+from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook
+from airflow.providers.oracle.hooks.oracle import OracleHook
+from airflow.utils.decorators import apply_defaults
+
+
+class MSSQLToOracleTransferOperator(BaseOperator):
+    """
+    Moves data from Oracle to MSSQL.
+
+
+    :param oracle_destination_conn_id: destination Oracle connection.
+    :type oracle_destination_conn_id: str
+    :param destination_table: destination table to insert rows.
+    :type destination_table: str
+    :param mssql_source_conn_id: source MSSQL connection.
+    :type mssql_source_conn_id: str
+    :param source_sql: SQL query to execute against the source MSSQL
+        database. (templated)
+    :type source_sql: str
+    :param source_sql_params: Parameters to use in sql query. (templated)
+    :type source_sql_params: dict
+    :param rows_chunk: number of rows per chunk to commit.
+    :type rows_chunk: int
+    """
+
+    template_fields = ('source_sql', 'source_sql_params')
+    ui_color = '#e08c8c'
+
+    @apply_defaults
+    def __init__(
+            self,
+            oracle_destination_conn_id,
+            destination_table,
+            mssql_source_conn_id,
+            source_sql,
+            source_sql_params=None,
+            rows_chunk=5000,
+            *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        if source_sql_params is None:
+            source_sql_params = {}
+        self.oracle_destination_conn_id = oracle_destination_conn_id
+        self.destination_table = destination_table
+        self.mssql_source_conn_id = mssql_source_conn_id
+        self.source_sql = source_sql
+        self.source_sql_params = source_sql_params
+        self.rows_chunk = rows_chunk
+
+    # pylint: disable=unused-argument
+    def _execute(self, src_hook, dest_hook, context):

Review comment:
       ```suggestion
       def _execute(self, src_hook, dest_hook):
   ```




----------------------------------------------------------------
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:
users@infra.apache.org