set application_name to tenant name (#7849)

This commit is contained in:
Christophe Siraut 2020-01-28 10:58:04 +01:00
parent f8882285de
commit e1b1afb2cf
1 changed files with 1 additions and 0 deletions

View File

@ -154,6 +154,7 @@ class DatabaseWrapper(original_backend.DatabaseWrapper):
# we do not have to worry that it's not the good one
try:
cursor_for_search_path.execute('SET search_path = {0}'.format(','.join(search_paths)))
cursor_for_search_path.execute('SET application_name = {0}'.format(self.schema_name))
except (django.db.utils.DatabaseError, psycopg2.InternalError):
self.search_path_set = False
else: