1👍
Have a look at django queryset reference. To get queries from querysets use queryset.query.__str__()
. For example if your query is as below
ipdb>queryset = User.objects.all()
ipdb>queryset.query.__str__()
u'SELECT `auth_user`.`id`, `auth_user`.`password`, `auth_user`.`last_login`, `auth_user`.`is_superuser`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`date_joined` FROM `auth_user`'
As per your last comment since you are using neo4j graphs, have a look at neo4j-django.
Source:stackexchange.com