hive.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334
  1. from app.core.datasource.datasource import DataSourceBase
  2. from app.core.datasource.hive import HiveDS
  3. from configs.settings import DefaultOption, config
  4. from utils import flat_map
  5. HOST = config.get('HIVE', 'HOST')
  6. PORT = config.get('HIVE', 'PORT')
  7. USERNAME = config.get('HIVE', 'USERNAME')
  8. PASSWORD = config.get('HIVE', 'PASSWORD')
  9. DATABASE_NAME = config.get('HIVE', 'DATABASE_NAME')
  10. KERBEROS = config.get('HIVE', 'KERBEROS')
  11. KEYTAB = config.get('HIVE', 'KEYTAB', vars=DefaultOption(config, 'HIVE', KEYTAB = None))
  12. KRB5CONFIG = config.get('HIVE', 'KRB5CONFIG', vars=DefaultOption(config, 'HIVE', KRB5CONFIG = None))
  13. KERBEROS_SERVICE_NAME = config.get('HIVE', 'KERBEROS_SERVICE_NAME', vars=DefaultOption(config, 'HIVE', KERBEROS_SERVICE_NAME = None))
  14. PRINCIPAL = config.get('HIVE', 'PRINCIPAL', vars=DefaultOption(config, 'HIVE', PRINCIPAL = None))
  15. ZOOKEEPER_ENABLE = config.get('HIVE', 'ZOOKEEPER_ENABLE', vars=DefaultOption(config, 'HIVE', ZOOKEEPER_ENABLE = 0))
  16. ZOOKEEPER_HOSTS = config.get('HIVE', 'ZOOKEEPER_HOSTS', vars=DefaultOption(config, 'HIVE', ZOOKEEPER_HOSTS = None))
  17. ZOOKEEPER_NAMESPACE = config.get('HIVE', 'ZOOKEEPER_NAMESPACE', vars=DefaultOption(config, 'HIVE', ZOOKEEPER_NAMESPACE = None))
  18. hiveDs = HiveDS(**{'type': 'hive',
  19. 'host': HOST,
  20. 'port': PORT,
  21. 'username': USERNAME,
  22. 'password': PASSWORD,
  23. 'database_name': DATABASE_NAME,
  24. 'kerberos': KERBEROS,
  25. 'keytab': KEYTAB,
  26. 'krb5config': KRB5CONFIG,
  27. 'kerberos_service_name': KERBEROS_SERVICE_NAME,
  28. 'principal':PRINCIPAL,
  29. 'path_type': 'local',
  30. 'zookeeper_enable': ZOOKEEPER_ENABLE,
  31. 'zookeeper_hosts': ZOOKEEPER_HOSTS,
  32. 'zookeeper_namespace': ZOOKEEPER_NAMESPACE})