Skip to content

Instantly share code, notes, and snippets.

@fcasco
Created May 25, 2019 21: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 fcasco/62ed6c2201f4323b8214ea73a02215d1 to your computer and use it in GitHub Desktop.
Save fcasco/62ed6c2201f4323b8214ea73a02215d1 to your computer and use it in GitHub Desktop.
Extra SQL en Django. 3
Person.objects.extra(select={'age': "(EXTRACT(year FROM age(birth_date)) :: int)"})\
.values('first_name', 'birth_date', 'age')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment