summaryrefslogtreecommitdiffstats
path: root/tools/upgrade/1.3/migrate_dbstats.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/upgrade/1.3/migrate_dbstats.py')
-rwxr-xr-xtools/upgrade/1.3/migrate_dbstats.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/upgrade/1.3/migrate_dbstats.py b/tools/upgrade/1.3/migrate_dbstats.py
index 2a2a112e9..c788aae37 100755
--- a/tools/upgrade/1.3/migrate_dbstats.py
+++ b/tools/upgrade/1.3/migrate_dbstats.py
@@ -8,7 +8,8 @@ import logging
import time
import Bcfg2.Logger
import Bcfg2.Options
-from django.db import connection, transaction, backend
+from Bcfg2.DBSettings import get_db_label
+from django.db import transaction, backend, connections
from Bcfg2.Server.Admin import UpdateReports
from Bcfg2.Reporting.utils import BatchFetch
from Bcfg2.Reporting.Compat import transaction
@@ -28,7 +29,8 @@ def _quote(value):
global _our_backend
if not _our_backend:
try:
- _our_backend = backend.DatabaseOperations(connection)
+ _our_backend = backend.DatabaseOperations(
+ connections[get_db_label('Reporting')])
except TypeError:
_our_backend = backend.DatabaseOperations()
return _our_backend.quote_name(value)
@@ -178,7 +180,7 @@ def _shove(old_table, new_table, columns):
cols,
_quote(old_table))
- cursor = connection.cursor()
+ cursor = connections[get_db_label('Reporting')].cursor()
cursor.execute(sql)
cursor.close()