Skip to content
Snippets Groups Projects
Commit c5992c03 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

postgres throws different error than sqlite

parent f6af6dc9
No related branches found
No related tags found
1 merge request!275Resolve "update automatic visit/subject importer"
Pipeline #34419 passed
......@@ -3,7 +3,7 @@ import logging
import traceback
import timeout_decorator
from django.db import OperationalError
from django.db import OperationalError, ProgrammingError
from django_cron import CronJobBase, Schedule
from web.models import ConfigurationItem
......@@ -21,7 +21,7 @@ class SubjectExporterCronJob(CronJobBase):
item = ConfigurationItem.objects.filter(type=SUBJECT_EXPORT_RUN_AT).first()
if item is not None:
RUN_AT_TIMES = item.value.split(';')
except OperationalError:
except (OperationalError, ProgrammingError): # sqlite and postgres throw different errors here
logger.debug('Looks like db is not initialized')
schedule = Schedule(run_at_times=RUN_AT_TIMES)
......@@ -61,7 +61,7 @@ class VisitExporterCronJob(CronJobBase):
item = ConfigurationItem.objects.filter(type=VISIT_EXPORT_RUN_AT).first()
if item is not None:
RUN_AT_TIMES = item.value.split(';')
except OperationalError:
except (OperationalError, ProgrammingError): # sqlite and postgres throw different errors here
logger.debug('Looks like db is not initialized')
schedule = Schedule(run_at_times=RUN_AT_TIMES)
code = 'web.export_visit_daily_job' # a unique code
......
......@@ -6,7 +6,7 @@ import os.path
import traceback
import timeout_decorator
from django.db import OperationalError
from django.db import OperationalError, ProgrammingError
from django_cron import CronJobBase, Schedule
from web.models import ConfigurationItem, Study, VisitImportData
......@@ -26,7 +26,7 @@ class SubjectImporterCronJob(CronJobBase):
item = ConfigurationItem.objects.filter(type=SUBJECT_IMPORT_RUN_AT).first()
if item is not None:
RUN_AT_TIMES = item.value.split(';')
except OperationalError:
except (OperationalError, ProgrammingError): # sqlite and postgres throw different errors here
logger.debug('Looks like db is not initialized')
schedule = Schedule(run_at_times=RUN_AT_TIMES)
code = 'web.import_subjects_daily_job' # a unique code
......@@ -71,7 +71,7 @@ class VisitImporterCronJob(CronJobBase):
item = VisitImportData.objects.filter(study_id=GLOBAL_STUDY_ID).first()
if item is not None:
RUN_AT_TIMES = item.run_at_times.split(';')
except OperationalError:
except (OperationalError, ProgrammingError): # sqlite and postgres throw different errors here
logger.debug('Looks like db is not initialized')
schedule = Schedule(run_at_times=RUN_AT_TIMES)
code = 'web.import_visits_daily_job' # a unique code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment