Fokko closed pull request #4043: [AIRFLOW-3174] Refine Docstring for SQL 
Operators & Hooks
URL: https://github.com/apache/incubator-airflow/pull/4043
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/hooks/dbapi_hook.py b/airflow/hooks/dbapi_hook.py
index 5b50ade34e..0bcbdf2f11 100644
--- a/airflow/hooks/dbapi_hook.py
+++ b/airflow/hooks/dbapi_hook.py
@@ -191,6 +191,7 @@ def get_autocommit(self, conn):
         Return True if conn.autocommit is set to True.
         Return False if conn.autocommit is not set or set to False or conn
         does not support autocommit.
+
         :param conn: Connection to get autocommit setting from.
         :type conn: connection object.
         :return: connection autocommit setting.
diff --git a/airflow/hooks/mysql_hook.py b/airflow/hooks/mysql_hook.py
index 51b53c1f8f..9ec8ca4d3e 100644
--- a/airflow/hooks/mysql_hook.py
+++ b/airflow/hooks/mysql_hook.py
@@ -49,6 +49,7 @@ def set_autocommit(self, conn, autocommit):
     def get_autocommit(self, conn):
         """
         MySql connection gets autocommit in a different way.
+
         :param conn: connection to get autocommit setting from.
         :type conn: connection object.
         :return: connection autocommit setting
diff --git a/airflow/operators/jdbc_operator.py 
b/airflow/operators/jdbc_operator.py
index a10bf30c5c..1c9423d5ab 100644
--- a/airflow/operators/jdbc_operator.py
+++ b/airflow/operators/jdbc_operator.py
@@ -28,12 +28,17 @@ class JdbcOperator(BaseOperator):
 
     Requires jaydebeapi.
 
-    :param jdbc_conn_id: reference to a predefined database
-    :type jdbc_conn_id: str
     :param sql: the sql code to be executed. (templated)
     :type sql: Can receive a str representing a sql statement,
         a list of str (sql statements), or reference to a template file.
         Template reference are recognized by str ending in '.sql'
+    :param jdbc_conn_id: reference to a predefined database
+    :type jdbc_conn_id: str
+    :param autocommit: if True, each command is automatically committed.
+        (default value: False)
+    :type autocommit: bool
+    :param parameters: (optional) the parameters to render the SQL query with.
+    :type parameters: mapping or iterable
     """
 
     template_fields = ('sql',)
diff --git a/airflow/operators/mssql_operator.py 
b/airflow/operators/mssql_operator.py
index f27e2145eb..086d1e39a9 100644
--- a/airflow/operators/mssql_operator.py
+++ b/airflow/operators/mssql_operator.py
@@ -26,11 +26,16 @@ class MsSqlOperator(BaseOperator):
     """
     Executes sql code in a specific Microsoft SQL database
 
-    :param mssql_conn_id: reference to a specific mssql database
-    :type mssql_conn_id: str
     :param sql: the sql code to be executed
     :type sql: str or string pointing to a template file with .sql
         extension. (templated)
+    :param mssql_conn_id: reference to a specific mssql database
+    :type mssql_conn_id: str
+    :param parameters: (optional) the parameters to render the SQL query with.
+    :type parameters: mapping or iterable
+    :param autocommit: if True, each command is automatically committed.
+        (default value: False)
+    :type autocommit: bool
     :param database: name of database which overwrite defined one in connection
     :type database: str
     """
diff --git a/airflow/operators/mysql_operator.py 
b/airflow/operators/mysql_operator.py
index e5bd788bd1..2cc9b07e34 100644
--- a/airflow/operators/mysql_operator.py
+++ b/airflow/operators/mysql_operator.py
@@ -26,12 +26,17 @@ class MySqlOperator(BaseOperator):
     """
     Executes sql code in a specific MySQL database
 
-    :param mysql_conn_id: reference to a specific mysql database
-    :type mysql_conn_id: str
     :param sql: the sql code to be executed. (templated)
     :type sql: Can receive a str representing a sql statement,
         a list of str (sql statements), or reference to a template file.
         Template reference are recognized by str ending in '.sql'
+    :param mysql_conn_id: reference to a specific mysql database
+    :type mysql_conn_id: str
+    :param parameters: (optional) the parameters to render the SQL query with.
+    :type parameters: mapping or iterable
+    :param autocommit: if True, each command is automatically committed.
+        (default value: False)
+    :type autocommit: bool
     :param database: name of database which overwrite defined one in connection
     :type database: str
     """
diff --git a/airflow/operators/oracle_operator.py 
b/airflow/operators/oracle_operator.py
index b97129715f..2d1a655f9a 100644
--- a/airflow/operators/oracle_operator.py
+++ b/airflow/operators/oracle_operator.py
@@ -26,12 +26,17 @@ class OracleOperator(BaseOperator):
     """
     Executes sql code in a specific Oracle database
 
-    :param oracle_conn_id: reference to a specific Oracle database
-    :type oracle_conn_id: str
     :param sql: the sql code to be executed. (templated)
     :type sql: Can receive a str representing a sql statement,
         a list of str (sql statements), or reference to a template file.
         Template reference are recognized by str ending in '.sql'
+    :param oracle_conn_id: reference to a specific Oracle database
+    :type oracle_conn_id: str
+    :param parameters: (optional) the parameters to render the SQL query with.
+    :type parameters: mapping or iterable
+    :param autocommit: if True, each command is automatically committed.
+        (default value: False)
+    :type autocommit: bool
     """
 
     template_fields = ('sql',)
diff --git a/airflow/operators/postgres_operator.py 
b/airflow/operators/postgres_operator.py
index e329100aa2..8f2aaf553d 100644
--- a/airflow/operators/postgres_operator.py
+++ b/airflow/operators/postgres_operator.py
@@ -25,12 +25,17 @@ class PostgresOperator(BaseOperator):
     """
     Executes sql code in a specific Postgres database
 
-    :param postgres_conn_id: reference to a specific postgres database
-    :type postgres_conn_id: str
     :param sql: the sql code to be executed. (templated)
     :type sql: Can receive a str representing a sql statement,
         a list of str (sql statements), or reference to a template file.
         Template reference are recognized by str ending in '.sql'
+    :param postgres_conn_id: reference to a specific postgres database
+    :type postgres_conn_id: str
+    :param autocommit: if True, each command is automatically committed.
+        (default value: False)
+    :type autocommit: bool
+    :param parameters: (optional) the parameters to render the SQL query with.
+    :type parameters: mapping or iterable
     :param database: name of database which overwrite defined one in connection
     :type database: str
     """
diff --git a/airflow/operators/sqlite_operator.py 
b/airflow/operators/sqlite_operator.py
index 8280075a32..fb4a30e350 100644
--- a/airflow/operators/sqlite_operator.py
+++ b/airflow/operators/sqlite_operator.py
@@ -26,11 +26,13 @@ class SqliteOperator(BaseOperator):
     """
     Executes sql code in a specific Sqlite database
 
-    :param sqlite_conn_id: reference to a specific sqlite database
-    :type sqlite_conn_id: str
     :param sql: the sql code to be executed. (templated)
     :type sql: str or string pointing to a template file. File must have
         a '.sql' extensions.
+    :param sqlite_conn_id: reference to a specific sqlite database
+    :type sqlite_conn_id: str
+    :param parameters: (optional) the parameters to render the SQL query with.
+    :type parameters: mapping or iterable
     """
 
     template_fields = ('sql',)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to