blob: ddcc825b8f9dfd2d5de12e2cb137f2d80b04d880 [file] [log] [blame]
:py:mod:`airflow.models.connection`
===================================
.. py:module:: airflow.models.connection
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.models.connection.Connection
Functions
~~~~~~~~~
.. autoapisummary::
airflow.models.connection.parse_netloc_to_hostname
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.models.connection.log
.. py:data:: log
.. py:function:: parse_netloc_to_hostname(*args, **kwargs)
This method is deprecated.
.. py:class:: Connection(conn_id = None, conn_type = None, description = None, host = None, login = None, password = None, schema = None, port = None, extra = None, uri = None)
Bases: :py:obj:`airflow.models.base.Base`, :py:obj:`airflow.utils.log.logging_mixin.LoggingMixin`
Placeholder to store information about different database instances
connection information. The idea here is that scripts use references to
database instances (conn_id) instead of hard coding hostname, logins and
passwords when using operators or hooks.
.. seealso::
For more information on how to use this class, see: :doc:`/howto/connection`
:param conn_id: The connection ID.
:param conn_type: The connection type.
:param description: The connection description.
:param host: The host.
:param login: The login.
:param password: The password.
:param schema: The schema.
:param port: The port number.
:param extra: Extra metadata. Non-standard data such as private/SSH keys can be saved here. JSON
encoded object.
:param uri: URI address describing connection parameters.
.. py:attribute:: EXTRA_KEY
:annotation: = __extra__
.. py:attribute:: __tablename__
:annotation: = connection
.. py:attribute:: id
.. py:attribute:: conn_id
.. py:attribute:: conn_type
.. py:attribute:: description
.. py:attribute:: host
.. py:attribute:: schema
.. py:attribute:: login
.. py:attribute:: port
.. py:attribute:: is_encrypted
.. py:attribute:: is_extra_encrypted
.. py:method:: on_db_load(self)
.. py:method:: parse_from_uri(self, **uri)
This method is deprecated. Please use uri parameter in constructor.
.. py:method:: get_uri(self)
Return connection in URI format
.. py:method:: get_password(self)
Return encrypted password.
.. py:method:: set_password(self, value)
Encrypt password and set in object attribute.
.. py:method:: password(cls)
:property:
Password. The value is decrypted/encrypted when reading/setting the value.
.. py:method:: get_extra(self)
Return encrypted extra-data.
.. py:method:: set_extra(self, value)
Encrypt extra-data and save in object attribute to object.
.. py:method:: extra(cls)
:property:
Extra data. The value is decrypted/encrypted when reading/setting the value.
.. py:method:: rotate_fernet_key(self)
Encrypts data with a new key. See: :ref:`security/fernet`
.. py:method:: get_hook(self, *, hook_params=None)
Return hook based on conn_type
.. py:method:: __repr__(self)
Return repr(self).
.. py:method:: log_info(self)
This method is deprecated. You can read each field individually or use the
default representation (`__repr__`).
.. py:method:: debug_info(self)
This method is deprecated. You can read each field individually or use the
default representation (`__repr__`).
.. py:method:: test_connection(self)
Calls out get_hook method and executes test_connection method on that.
.. py:method:: extra_dejson(self)
:property:
Returns the extra property by deserializing json.
.. py:method:: get_connection_from_secrets(cls, conn_id)
:classmethod:
Get connection by conn_id.
:param conn_id: connection id
:return: connection
.. py:method:: from_json(cls, value, conn_id=None)
:classmethod: