Monday, September 29, 2014

Need example to implement sql (dictionary) translations

From the django project web site, I am trying to implement the following code and have it spit out the dictionary form of the sql.

Does anyone have an example of how this is done.

The code below is from the project web page

When I execute the 2 lines below I retrieve the following
<RawQuerySet: 'SELECT first_name AS first, last_name AS last FROM person'>

Does anyone have an example so that  I can get this into a dictionary format so that I can send it back to the web page for consumption?

>>> name_map = {'first': 'first_name', 'last': 'last_name', 'bd': 'birth_date', 'pk': 'id'}  >>> Person.objects.raw('SELECT * FROM some_other_table', translations=name_map)

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment