[core] dbms swap caching key username to id.
@@ -57,21 +57,21 @@ def get(user, query_server=None, cluster=None):
DBMS_CACHE_LOCK.acquire()
try:
- DBMS_CACHE.setdefault(user.username, {})
+ DBMS_CACHE.setdefault(user.id, {})
- if query_server['server_name'] not in DBMS_CACHE[user.username]:
+ if query_server['server_name'] not in DBMS_CACHE[user.id]:
# Avoid circular dependency
from beeswax.server.hive_server2_lib import HiveServerClientCompatible
if query_server['server_name'].startswith('impala'):
from impala.dbms import ImpalaDbms
from impala.server import ImpalaServerClient
- DBMS_CACHE[user.username][query_server['server_name']] = ImpalaDbms(HiveServerClientCompatible(ImpalaServerClient(query_server, user)), QueryHistory.SERVER_TYPE[1][0])
+ DBMS_CACHE[user.id][query_server['server_name']] = ImpalaDbms(HiveServerClientCompatible(ImpalaServerClient(query_server, user)), QueryHistory.SERVER_TYPE[1][0])
else:
from beeswax.server.hive_server2_lib import HiveServerClient
- DBMS_CACHE[user.username][query_server['server_name']] = HiveServer2Dbms(HiveServerClientCompatible(HiveServerClient(query_server, user)), QueryHistory.SERVER_TYPE[1][0])
+ DBMS_CACHE[user.id][query_server['server_name']] = HiveServer2Dbms(HiveServerClientCompatible(HiveServerClient(query_server, user)), QueryHistory.SERVER_TYPE[1][0])
- return DBMS_CACHE[user.username][query_server['server_name']]
+ return DBMS_CACHE[user.id][query_server['server_name']]
finally:
DBMS_CACHE_LOCK.release()
