use union all when building trait query

union all is more performant as it doesn't need to filter out
duplicates. we should not have duplicates as the primary key
conditions already ensure that.

Change-Id: Ic25f7086b33a98ca77a669732a65be5a95b7f0db
This commit is contained in:
gord chung 2015-06-13 01:20:12 -04:00 committed by gordon chung
parent 3c10d3876e
commit 34a3a11c96

View File

@ -282,7 +282,7 @@ class Connection(base.Connection):
sa.cast(sa.null(), sa.String(255)))
.filter(sa.exists().where(
models.TraitDatetime.event_id == query.subquery().c.id))
).union(
).union_all(
session.query(
models.TraitInt.event_id,
models.TraitInt.key, sa.null(),