blob: 4c08436e90c7004ef5001db61bc3ac00480d33d7 [file] [log] [blame]
:mod:`airflow.hooks.mysql_hook`
===============================
.. py:module:: airflow.hooks.mysql_hook
Module Contents
---------------
.. py:class:: MySqlHook(*args, **kwargs)
Bases::class:`airflow.hooks.dbapi_hook.DbApiHook`
Interact with MySQL.
You can specify charset in the extra field of your connection
as ``{"charset": "utf8"}``. Also you can choose cursor as
``{"cursor": "SSCursor"}``. Refer to the MySQLdb.cursors for more details.
.. attribute:: conn_name_attr
:annotation: = mysql_conn_id
.. attribute:: default_conn_name
:annotation: = mysql_default
.. attribute:: supports_autocommit
:annotation: = True
.. method:: set_autocommit(self, conn, autocommit)
MySql connection sets autocommit in a different way.
.. method:: 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
:rtype: bool
.. method:: get_conn(self)
Returns a mysql connection object
.. method:: bulk_load(self, table, tmp_file)
Loads a tab-delimited file into a database table
.. method:: bulk_dump(self, table, tmp_file)
Dumps a database table into a tab-delimited file
.. staticmethod:: _serialize_cell(cell, conn)
MySQLdb converts an argument to a literal
when passing those separately to execute. Hence, this method does nothing.
:param cell: The cell to insert into the table
:type cell: object
:param conn: The database connection
:type conn: connection object
:return: The same cell
:rtype: object