Skip to content

Commit

Permalink
Merge pull request #342 from EBI-Metagenomics/update-test-db-fixtures
Browse files Browse the repository at this point in the history
Fixes regression bug due to ERA Tablespace workaround
  • Loading branch information
SandyRogers authored Jan 12, 2024
2 parents 7b73cfa + ed1604b commit 808dab4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/local-lite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ emg:
era:
ENGINE: 'django.db.backends.sqlite3'
NAME: '/opt/ci/testdbs/ena-testdb.sqlite'
ERA_TABLESPACE_PREFIX: ''

admin: True
downloads_bypass_nginx: True
Expand Down
9 changes: 6 additions & 3 deletions emgena/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
from __future__ import unicode_literals

from datetime import date
from django.db import models, NotSupportedError

from django.conf import settings
from django.db import models


class Status(models.IntegerChoices):
Expand Down Expand Up @@ -197,8 +199,9 @@ class Meta(StudyAbstract.Meta):
# ERA needs to be appended as the default connection tries to use
# the PUBLIC SYNONYM (according to ENA) and it's not working ATM
# we were advised to prefix the views and this is the simplest way.
# The short-term plan is to remove the dependency of ENA databases
db_table = 'ERA\".\"V_MGP_RUN_STUDY'
# The short-term plan is to remove the dependency of ENA databases
_prefix_workaround = settings.DATABASES.get('era', {}).get('ERA_TABLESPACE_PREFIX', 'ERA\".\"')
db_table = f'{_prefix_workaround}V_MGP_RUN_STUDY'


class AssemblyStudy(StudyAbstract):
Expand Down

0 comments on commit 808dab4

Please sign in to comment.