Esempio n. 1
0
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Imports the hooks dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs

_hooks = {
    'ftp_hook': ['FTPHook'],
    'ftps_hook': ['FTPSHook'],
    'vertica_hook': ['VerticaHook'],
    'ecs_hook': ['ECSHook'],
    'ssh_hook': ['SSHHook'],
    'bigquery_hook': ['BigQueryHook'],
    'qubole_hook': ['QuboleHook'],
    'gcs_hook': ['GoogleCloudStorageHook'],
    'datastore_hook': ['DatastoreHook'],
    'cloudant_hook': ['CloudantHook']
}

_import_module_attrs(globals(), _hooks)
Esempio n. 2
0
    'presto_to_mysql': ['PrestoToMySqlTransfer'],
    's3_file_transform_operator': ['S3FileTransformOperator'],
    # 'http_operator': ['SimpleHttpOperator'],
    'hive_to_druid': ['HiveToDruidTransfer'],
    'jdbc_operator': ['JdbcOperator'],
    'mssql_operator': ['MsSqlOperator'],
    'mssql_to_hive': ['MsSqlToHiveTransfer'],
    'slack_operator': ['SlackAPIOperator', 'SlackAPIPostOperator'],
    'generic_transfer': ['GenericTransfer'],
    'oracle_operator': ['OracleOperator']
}

import os as _os
if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
    from zope.deprecation import deprecated as _deprecated
    _imported = _import_module_attrs(globals(), _operators)
    for _i in _imported:
        _deprecated(
            _i,
            "Importing {i} directly from 'airflow.operators' has been "
            "deprecated. Please import from "
            "'airflow.operators.[operator_module]' instead. Support for direct "
            "imports will be dropped entirely in Airflow 2.0.".format(i=_i))


def _integrate_plugins():
    """Integrate plugins to the context"""
    import sys
    from airflow.plugins_manager import operators as _operators
    for _operator_module in _operators:
        sys.modules[_operator_module.__name__] = _operator_module
Esempio n. 3
0
        'HiveMetastoreHook',
        'HiveServer2Hook',
    ],
    'hdfs_hook': ['HDFSHook'],
    'webhdfs_hook': ['WebHDFSHook'],
    'pig_hook': ['PigCliHook'],
    'mysql_hook': ['MySqlHook'],
    'postgres_hook': ['PostgresHook'],
    'presto_hook': ['PrestoHook'],
    'samba_hook': ['SambaHook'],
    'sqlite_hook': ['SqliteHook'],
    'S3_hook': ['S3Hook'],
    'http_hook': ['HttpHook'],
    'druid_hook': ['DruidHook'],
    'jdbc_hook': ['JdbcHook'],
    'dbapi_hook': ['DbApiHook'],
    'mssql_hook': ['MsSqlHook'],
    'oracle_hook': ['OracleHook'],
    'redis_hook': ['RedisHook'],
    'memcache_hook': ['MemcacheHook']
}

_import_module_attrs(globals(), _hooks)


def integrate_plugins():
    """Integrate plugins to the context"""
    from airflow.plugins_manager import hooks as _hooks
    for _h in _hooks:
        globals()[_h.__name__] = _h
Esempio n. 4
0
# Imports operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs

# These need to be integrated first as other operators depend on them
_import_module_attrs(globals(), {
    'check_operator': [
        'CheckOperator',
        'ValueCheckOperator',
        'IntervalCheckOperator',
    ],
})

_operators = {
    'bash_operator': ['BashOperator'],
    'python_operator': [
        'PythonOperator',
        'BranchPythonOperator',
        'ShortCircuitOperator',
    ],
    'hive_operator': ['HiveOperator'],
    'pig_operator': ['PigOperator'],
    'presto_check_operator': [
        'PrestoCheckOperator',
        'PrestoValueCheckOperator',
        'PrestoIntervalCheckOperator',
    ],
    'dagrun_operator': ['TriggerDagRunOperator'],
    'dummy_operator': ['DummyOperator'],
    'email_operator': ['EmailOperator'],
    'hive_to_samba_operator': ['Hive2SambaOperator'],
# Imports operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs

# These need to be integrated first as other operators depend on them
_import_module_attrs(globals(), {
    'check_operator': [
        'CheckOperator',
        'ValueCheckOperator',
        'IntervalCheckOperator',
    ],
})

_operators = {
    'bash_operator': ['BashOperator'],
    'python_operator': [
        'PythonOperator',
        'BranchPythonOperator',
        'ShortCircuitOperator',
    ],
    'hive_operator': ['HiveOperator'],
    'pig_operator': ['PigOperator'],
    'presto_check_operator': [
        'PrestoCheckOperator',
        'PrestoValueCheckOperator',
        'PrestoIntervalCheckOperator',
    ],
    'dagrun_operator': ['TriggerDagRunOperator'],
    'dummy_operator': ['DummyOperator'],
    'email_operator': ['EmailOperator'],
    'hive_to_samba_operator': ['Hive2SambaOperator'],
Esempio n. 6
0
# Imports the operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs

_operators = {
    "ssh_execute_operator": ["SSHExecuteOperator"],
    "vertica_operator": ["VerticaOperator"],
    "vertica_to_hive": ["VerticaToHiveTransfer"],
    "qubole_operator": ["QuboleOperator"],
}

_import_module_attrs(globals(), _operators)