Feature re: Select Periodic Task joined with discriminator table
Expected Behavior
When querying on PeriodicTask table using session.query(PeriodicTask), the joined schedule table is related to the schedule_id AND the discriminator.
Actual Behavior
When querying, if the same id exists in both schedule tables, both joined tables are returned.
Test sample
def test_PeriodicTask_specifyjoin(self):
p = self.create_model_interval(self.session, schedule(timedelta(seconds=3)))
c = self.create_model_crontab(self.session, crontab(minute="3", hour="3"))
self.session.add(p)
self.session.add(c)
self.session.commit()
p = self.session.query(PeriodicTask).first()
assert p.schedule_id == 1
assert c.schedule_id == 1
assert p.discriminator == 'intervalschedule'
assert p.model_crontabschedule is None # this would fail prior to these changes
assert p.model_intervalschedule is not None
assert c.discriminator == 'crontabschedule'
assert c.model_intervalschedule is None # this would fail as well
assert c.model_crontabschedule is not None
Thoughts
In the older implementation (celery_sqlalchemy_scheduler), there were two separate foreign keys specifically connected by crontab_id and interval_id. The newer version uses the discriminator column and the reasoning behind this seems vague.
Feature re: Select Periodic Task joined with discriminator table
Expected Behavior
When querying on PeriodicTask table using
session.query(PeriodicTask)
, the joined schedule table is related to the schedule_id AND the discriminator.Actual Behavior
When querying, if the same id exists in both schedule tables, both joined tables are returned.
Test sample
Thoughts
In the older implementation (celery_sqlalchemy_scheduler), there were two separate foreign keys specifically connected by crontab_id and interval_id. The newer version uses the discriminator column and the reasoning behind this seems vague.
Collaborators
Matthew Bronstein Bazyl Horsey