Skip to content

Commit

Permalink
[AIRFLOW-3174] Refine Docstring for SQL Operators & Hooks (#4043)
Browse files Browse the repository at this point in the history
Add missing arguments
  • Loading branch information
XD-DENG authored and Fokko committed Oct 13, 2018
1 parent 3535836 commit 90e6fa1
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 12 deletions.
1 change: 1 addition & 0 deletions airflow/hooks/dbapi_hook.py
Expand Up @@ -192,6 +192,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.
Expand Down
1 change: 1 addition & 0 deletions airflow/hooks/mysql_hook.py
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions airflow/operators/jdbc_operator.py
Expand Up @@ -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',)
Expand Down
9 changes: 7 additions & 2 deletions airflow/operators/mssql_operator.py
Expand Up @@ -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
"""
Expand Down
9 changes: 7 additions & 2 deletions airflow/operators/mysql_operator.py
Expand Up @@ -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
"""
Expand Down
9 changes: 7 additions & 2 deletions airflow/operators/oracle_operator.py
Expand Up @@ -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',)
Expand Down
9 changes: 7 additions & 2 deletions airflow/operators/postgres_operator.py
Expand Up @@ -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
"""
Expand Down
6 changes: 4 additions & 2 deletions airflow/operators/sqlite_operator.py
Expand Up @@ -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',)
Expand Down

0 comments on commit 90e6fa1

Please sign in to comment.