Skip to content

Instantly share code, notes, and snippets.

@kyle-eshares
Last active January 17, 2017 15:35
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 kyle-eshares/f702dee68241e70f7187377ed8b6f8e7 to your computer and use it in GitHub Desktop.
Save kyle-eshares/f702dee68241e70f7187377ed8b6f8e7 to your computer and use it in GitHub Desktop.
from django.db import connection
def flatten(*args):
def transform_pipeline(mdl):
data = FlatData()
num_before = len(connection.queries)
for fn in args:
fn(data, mdl)
assert len(connection.queries) == num_before
return data
return transform_pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment