Skip to content

Instantly share code, notes, and snippets.

@mac01021
Created December 19, 2013 21:20
Show Gist options
  • Select an option

  • Save mac01021/8046451 to your computer and use it in GitHub Desktop.

Select an option

Save mac01021/8046451 to your computer and use it in GitHub Desktop.
a query
records =\
(session.query(LaborItem)
.join(ServiceUnit, ServiceUnit.id == LaborItem.punch_unit_id)
.filter(LaborItem.date <= days[-1])
.filter(LaborItem.date >= days[0])
.filter(*unit_filters(LaborItem.punch_unit_id))
.filter(ServiceUnit.is_active_sql(days[-1]))# is this what we want for long date ranges?
.options(sa.orm.joinedload('pay_type'))
.options(sa.orm.joinedload('pay_type.versions'))
.options(sa.orm.joinedload('punch_job'))
.options(sa.orm.joinedload('punch_benefit_calculation_rule'))
).all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment