Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-3174] Refine Docstring for SQL Operators & Hooks #4043

Merged
merged 1 commit into from
Oct 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions airflow/hooks/dbapi_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions airflow/hooks/mysql_hook.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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