示例#1
0
 def _get_jdbc_params(self) -> Dict[str, str]:
     """Get JDBC parameters."""
     jdbc_config = read_config(JDBC_CONFIG)
     try:
         db = jdbc_config[self.source_system.upper()]
     except KeyError as e:
         raise KeyError('Section %s is missing in jdbc config.' % e)
     try:
         jdbc_params = {
             'TYPE':
             db['type'],
             'URI':
             db['uri'],
             'PORT':
             db['port'],
             'USER':
             db['user'],
             'PASSWORD':
             self._get_jdbc_pass(db),
             'DATABASE':
             db.get('database').format(
                 schema=self.get_source_subsystem().upper()),
             'SCHEMA':
             self.get_null_param('schema', self.get_source_subsystem()),
             'DRIVER_PATH':
             JDBC_DRIVER_PATH.get(db['type']),
             'FETCH_ROWS':
             self.get_null_param('fetch_rows', self.fetch_rows)
         }
         return jdbc_params
     except KeyError as e:
         raise KeyError(
             f'In section {self.source_system.upper()} attrubute {e} is missing in jdbc config.'
         )
示例#2
0
 def _get_es_params(self) -> Dict[str, str]:
     """Get JDBC parameters."""
     es_conf = read_config(ES_CONFIG)
     try:
         es = es_conf[self.source_system.upper()]
     except KeyError as e:
         raise KeyError('Section %s is missing in es config.' % e)
     try:
         es_params = {
             'ES_URI': es['uri'],
             'ES_PORT': es['port'],
             'ES_USER': es['user'],
             'ES_PASSWORD': self._get_es_pass(es),
             'ES_SCHEME': es['scheme'],
         }
         return es_params
     except KeyError as e:
         raise KeyError(
             f'In section {self.source_system.upper()} attrubute {e} is missing in jdbc config.'
         )
示例#3
0
文件: config.py 项目: lmc-eu/luft
 def __init__(self, config_file: str):
     self.cfg = read_config(config_file)