[PyDelhi] [Query] [DRF] Raw SQL Query by passing Model and Model Serializer

Aniket Maithani maithani.aniket at gmail.com
Fri Oct 30 17:23:27 EDT 2015


On Fri, Oct 30, 2015 at 9:44 AM, Gora Mohanty <gora at mimirtech.com> wrote:

>
>
> Agreed. It would make sense to just use a Django view. Not everything
> has to go through DRF even if you are using it, though I would then
> question whether you need DRF at all.
>
> Maybe you could explain what you are trying to do.
>

Okay. So I am actually creating an API for one of the Android based
application. You can read about it here [0]. Now what I want is I have a
dataset now all I want is to get the result from the database using raw
query and the result of that query should be in JSON format.

To explain for instance :
Endpoint : /search
request :
{
"name": "abc"
}

Response
{
"name":"abc"
"foo":"bar"
"foo1":"bar1"
}

Now I want all this to be done without the use of actually putting models
in there.

Apologies, If I am unable to be clear on explaining what I want to do.


[0] : http://aniketmaithani.github.io/KYR2/

[1] :
https://github.com/aniketmaithani/KYR2/blob/custom-sql-query/kyr/parliament/api.py


-- 
Aniket Maithani
www.aniketmaithani.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ncr-python.in/attachments/20151031/b09f02be/attachment.html>


More information about the Ncr-Python.in mailing list