diff --git a/redash/query_runner/presto.py b/redash/query_runner/presto.py index d4c919d380..e33c07abc6 100644 --- a/redash/query_runner/presto.py +++ b/redash/query_runner/presto.py @@ -98,14 +98,16 @@ def get_schema(self, get_stats=False): return schema.values() def run_query(self, query, user): + user_name = self.configuration.get('username', user.email.split('@')[0] if user is not None else 'redash') connection = presto.connect( - host=self.configuration.get('host', ''), - port=self.configuration.get('port', 8080), - protocol=self.configuration.get('protocol', 'http'), - username=self.configuration.get('username', 'redash'), - password=self.configuration.get('password'), - catalog=self.configuration.get('catalog', 'hive'), - schema=self.configuration.get('schema', 'default')) + host=self.configuration.get('host', ''), + port=self.configuration.get('port', 8080), + protocol=self.configuration.get('protocol', 'http'), + username=user_name, + password=self.configuration.get('password', None), + source='redash', + catalog=self.configuration.get('catalog', 'hive'), + schema=self.configuration.get('schema', 'default')) cursor = connection.cursor()