Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes regression bug due to ERA Tablespace workaround #342

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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