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

kracekumar ramaraju kracethekingmaker at gmail.com
Tue Nov 3 01:07:22 EST 2015


On Tue, Nov 3, 2015 at 11:10 AM, Anuvrat Parashar <anuvrat at anuvrat.in>
wrote:

> @aniket
>
> On Sun, Nov 1, 2015 at 1:14 AM, ragsagar <ragsagar at gmail.com> wrote:
>
>>
>>
>> On Sat, Oct 31, 2015 at 2:14 AM, Aniket Maithani <
>> maithani.aniket at gmail.com> wrote:
>>
>>>
>>>
>>>
>>> On Sat, Oct 31, 2015 at 3:26 AM, Raakesh kumar <kumar3180 at gmail.com>
>>> wrote:
>>>
>>>>
>>>> Just for my curiosity, why do you want to remove model interaction? I
>>>> mean you can achieve it with models also
>>>>
>>>
>>>
>>> Well point being I already have the data in the database (parsed from
>>> the website) . Which I have exported. And since I know the data is going to
>>> remain unchanged for some-time I feel there is no need to create model for
>>> the same (Correct me If I am wrong here). Therefore I just want simple
>>> query and output mechanism, that's all.
>>>
>> [correcting you] you create models in Django to make it easier to do all
> of CRUD easily which more often than others involves querying the db.
>
>
> Now, you orrect me if I am wrong.
>  - you have a database with some values present in them.
>  - you want to create an API layer over it, to power some basic searching,
> filtering etc.
>  - you don't want to create django models for them.
>
> so there is no CRUD, why do you need restful API?
> and if there is no restful API, why do you need DRF?
> if there are no models and no DRF, why do you need Django?
>
> I would have opted for either of:
>  - dump the data in elasticsearch, put it behind nginx. ready.
>

Make sure to use python elasticsearch binding at least to prevent
elasticsearch injection similar to SQL Injection.


>  - dump the data in mongodb and use http://python-eve.org/ to build the
> API layer.
>
> Using a Knife to do a rock's job is not wise either :P, if you know what I
> mean.
>
>
>
>>>
>> Use the management command `inspectdb`. It will inspect your existing
>> tables and create models for you. Then you can use DRF's generic views
>> itself.  Read more here.
>> https://docs.djangoproject.com/en/1.8/howto/legacy-databases/
>>
>> --
>> blog : ragsagar.wordpress.com
>> mail id : python -c "print '@'.join(['ragsagar','.'.join([x for x in
>> ['gmail','com']])])"
>>
>> _______________________________________________
>> https://mail.python.org/mailman/listinfo/ncr-python.in
>> http://bit.ly/pydelhi-mailinglist-guidelines
>>
>
>
>
> --
> Anuvrat Parashar <http://anuvrat.in>
> http://anuvrat.in
>
>
> _______________________________________________
> https://mail.python.org/mailman/listinfo/ncr-python.in
> http://bit.ly/pydelhi-mailinglist-guidelines
>



-- 

*Thanks & Regardskracekumar"Talk is cheap, show me the code" -- Linus
Torvaldshttp://kracekumar.com <http://kracekumar.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ncr-python.in/attachments/20151103/b1e7b836/attachment-0001.html>


More information about the Ncr-Python.in mailing list