Skip to content

Instantly share code, notes, and snippets.

@brutus
Last active December 28, 2015 10:29
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 brutus/7486362 to your computer and use it in GitHub Desktop.
Save brutus/7486362 to your computer and use it in GitHub Desktop.

Here is the query I use to get the data:

q = db.query(Stat, Song, Commit).join(Song).join(Commit)

Well, I actually use something like db.query(Stat.rating, Stat.play_count, Song.path, ....

Now I can filter the results like this:

if user:
  q = q.filter(Commit.user == user)
if device:
  q = q.filter(Commit.device == device)
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment