Created
August 9, 2019 22:23
-
-
Save audy/63ef668400347f0bf939a08c40a01ef9 to your computer and use it in GitHub Desktop.
Who needs an ORM?
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
#!/usr/bin/env python3 | |
from models import * | |
def query(func): | |
def run_query(): | |
rows = get_database().execute_sql(func.__doc__.strip()) | |
for row in rows: | |
yield row | |
return run_query | |
@query | |
def get_experiments(): | |
""" | |
select * from experiment limit 1 | |
""" | |
print(list(get_experiments())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment