engine: add setting for postgresql init statements (#38462)

This commit is contained in:
Benjamin Dauvergne 2019-12-12 14:43:42 +01:00
parent 4f9c50badd
commit 79a965f328
2 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import hashlib
import psycopg2
from django.core.cache import cache
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from . import schemas
@ -526,4 +527,6 @@ class Engine(object):
with connection.cursor() as cursor:
search_path = ', '.join(['%s' % namespace for namespace in self.warehouse.search_path])
cursor.execute('SET SEARCH_PATH = %s' % search_path)
for statement in getattr(settings, 'BIJOE_INIT_SQL', []):
cursor.execute(statement)
yield cursor

View File

@ -1 +1,4 @@
BIJOE_CACHE = False
BIJOE_INIT_SQL = [
'SET lc_time = \'fr_FR.UTF-8\'',
]