Skip to content

Instantly share code, notes, and snippets.

@anxiousmodernman
Created January 2, 2014 03:46
Show Gist options
  • Save anxiousmodernman/8214761 to your computer and use it in GitHub Desktop.
Save anxiousmodernman/8214761 to your computer and use it in GitHub Desktop.
make a interface/facade here?
@app.route('/search', methods=['POST'])
def handle_search_call():
# todo implement facade for request
q = db_session.query(SubscriberTable.first_name,
SubscriberTable.last_name,
SubscriberTable.last_open,
SubscriberTable.email,
SubscriberTable.company).\
join(SubscriberBriefProfileTable)
for k, v in request.json:
q = q.filter(getattr(SubscriberTable, v).like("%%%s%%" % v))
q = q.limit(20) # todo raise limit
# result set
result_set = q.all()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment