Skip to content

Commit

Permalink
set os_name to str(uid) if user name is not defined for current uid
Browse files Browse the repository at this point in the history
  • Loading branch information
wawaka committed May 17, 2019
1 parent 4592862 commit fafc3db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clickhouse_driver/clientinfo.py
@@ -1,3 +1,4 @@
import os
import socket
import getpass

Expand Down Expand Up @@ -36,7 +37,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 = str(os.getuid())
self.client_hostname = socket.gethostname()
self.client_name = client_name

Expand Down

0 comments on commit fafc3db

Please sign in to comment.