Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@audy
Created August 9, 2019 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audy/63ef668400347f0bf939a08c40a01ef9 to your computer and use it in GitHub Desktop.
Save audy/63ef668400347f0bf939a08c40a01ef9 to your computer and use it in GitHub Desktop.
Who needs an ORM?
#!/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