示例#1
0
文件: dbms.py 项目: 277800076/hue
def get_query_server_config(server=None):
  if not server or server not in DATABASES:
    keys = DATABASES.keys()
    name = keys and keys[0] or None
  else:
    name = server

  if name:
    query_server = {
      'server_name': DATABASES[name].ENGINE.get().split('.')[-1],
      'server_host': DATABASES[name].HOST.get(),
      'server_port': DATABASES[name].PORT.get(),
      'username': DATABASES[name].USER.get(),
      'password': get_database_password(name),
      'options': force_dict_to_strings(DATABASES[name].OPTIONS.get()),
      'alias': name
    }

    if DATABASES[name].NAME.get():
      query_server['name'] = DATABASES[name].NAME.get()
  else:
    query_server = {}

  LOG.debug("Query Server: %s" % query_server)

  return query_server
示例#2
0
def get_query_server_config(server=None):
    if not server or server not in DATABASES:
        keys = DATABASES.keys()
        name = keys and keys[0] or None
    else:
        name = server

    if name:
        query_server = {
            'server_name': DATABASES[name].ENGINE.get().split('.')[-1],
            'server_host': DATABASES[name].HOST.get(),
            'server_port': DATABASES[name].PORT.get(),
            'username': DATABASES[name].USER.get(),
            'password': DATABASES[name].PASSWORD.get(),
            'options': force_dict_to_strings(DATABASES[name].OPTIONS.get()),
            'alias': name
        }

        if DATABASES[name].NAME.get():
            query_server['name'] = DATABASES[name].NAME.get()
    else:
        query_server = {}

    LOG.debug("Query Server: %s" % query_server)

    return query_server
示例#3
0
文件: dbms.py 项目: shobull/hue
def get_query_server_config(server=None):
    if not server or server not in DATABASES:
        keys = DATABASES.keys()
        name = keys and keys[0] or None
    else:
        name = server

    if name:
        query_server = {
            "server_name": DATABASES[name].ENGINE.get().split(".")[-1],
            "server_host": DATABASES[name].HOST.get(),
            "server_port": DATABASES[name].PORT.get(),
            "username": DATABASES[name].USER.get(),
            "password": get_database_password(name),
            "options": force_dict_to_strings(DATABASES[name].OPTIONS.get()),
            "alias": name,
        }

        if DATABASES[name].NAME.get():
            query_server["name"] = DATABASES[name].NAME.get()
    else:
        query_server = {}

    LOG.debug("Query Server: %s" % query_server)

    return query_server