Created
January 2, 2014 03:46
-
-
Save anxiousmodernman/8214761 to your computer and use it in GitHub Desktop.
make a interface/facade here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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