From 1c59b79eed70d4985abf064e74a57b4653956a3a Mon Sep 17 00:00:00 2001 From: Vladimir Kozbin Date: Fri, 17 May 2019 12:12:41 +0700 Subject: [PATCH] fallback for os_name if user name is not defined --- clickhouse_driver/clientinfo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clickhouse_driver/clientinfo.py b/clickhouse_driver/clientinfo.py index 3c67e025..fbdda8ab 100644 --- a/clickhouse_driver/clientinfo.py +++ b/clickhouse_driver/clientinfo.py @@ -36,7 +36,10 @@ class QueryKind(object): def __init__(self, client_name): self.query_kind = ClientInfo.QueryKind.NO_QUERY - self.os_user = getpass.getuser() + try: + self.os_user = getpass.getuser() + except KeyError: + self.os_user = '' self.client_hostname = socket.gethostname() self.client_name = client_name