Skip to content

Commit 2bc216f

Browse files
ryanpetrelloask
authored andcommitted
Add the ability to specify __tablename__ for SQLALchemy tables.
1 parent 9137d68 commit 2bc216f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

celery/app/defaults.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ def __repr__(self):
125125
'REDIS_MAX_CONNECTIONS': Option(type='int'),
126126
'RESULT_BACKEND': Option(type='string'),
127127
'RESULT_DB_SHORT_LIVED_SESSIONS': Option(False, type='bool'),
128+
'RESULT_DB_TASK_TABLENAME': Option('celery_taskmeta'),
129+
'RESULT_DB_TASKSET_TABLENAME': Option('celery_tasksetmeta'),
128130
'RESULT_DBURI': Option(),
129131
'RESULT_ENGINE_OPTIONS': Option(type='dict'),
130132
'RESULT_EXCHANGE': Option('celeryresults'),

celery/backends/database/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def __init__(self, dburi=None, expires=None,
6969
'short_lived_sessions',
7070
conf.CELERY_RESULT_DB_SHORT_LIVED_SESSIONS,
7171
)
72+
73+
Task.__table__.name = conf.CELERY_RESULT_DB_TASK_TABLENAME
74+
TaskSet.__table__.name = conf.CELERY_RESULT_DB_TASKSET_TABLENAME
75+
7276
if not self.dburi:
7377
raise ImproperlyConfigured(
7478
'Missing connection string! Do you have '

0 commit comments

Comments
 (0)