On Mon, Jul 11, 2011 at 10:36, Venkatraman S wrote:
> Raw-sql and the snippet provided by me would end up generating the same sql.
>
> One advantage of my snippet is, if your db does not support sin/cos
> functions(like sqlite3),
> then you can go ahead defining funcs which computes the same. Som
On Mon, Jul 11, 2011 at 10:36 PM, Jonas Geiregat wrote:
> >
> > results.extra(select={
> > 'distance':
> '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(latitude)f)*cos(%(longitude)f-longitude)))'
> % {
> > 'latitude': latit
On Tue, Jul 12, 2011 at 4:36 AM, sanket wrote:
> Thanks @Venkatraman, I really appreciate your help.
> ability to create a function is pretty cool.
>
Thanks. Actually, i stumbled on this solution due to my use case - i test
all my apps in sqlite3 and then move to other dbs; as it is easy for me
Thanks @Venkatraman, I really appreciate your help.
ability to create a function is pretty cool.
Thanks again,
sanket
On Jul 11, 1:06 pm, Jonas Geiregat wrote:
> > results.extra(select={
> > 'distance':
> > '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(l
>
> results.extra(select={
> 'distance':
> '(acos(sin(latitude)*sin(%(latitude)f)+cos(latitude)*cos(%(latitude)f)*cos(%(longitude)f-longitude)))'
> % {
> 'latitude': latitude,
> 'longitude': longitude
Thats pretty cool, I didnt know you could do create function. Will check
this out later :)
On 11 Jul 2011 06:06, "Venkatraman S" wrote:
> On Mon, Jul 11, 2011 at 10:02 AM, sanket wrote:
>
>> I think I would go ahead with executing the raw SQL in this case.
>> The solution by @Venatraman looks int
On Mon, Jul 11, 2011 at 10:02 AM, sanket wrote:
> I think I would go ahead with executing the raw SQL in this case.
> The solution by @Venatraman looks interesting too. I would give it a
> try.
>
Raw-sql and the snippet provided by me would end up generating the same sql.
One advantage of my sn
Thanks all for the help,
I really appreciate it.
I think I would go ahead with executing the raw SQL in this case.
The solution by @Venatraman looks interesting too. I would give it a
try.
I might write a stored procedure if I start getting performance issues
if data starts growing.
Thanks again,
On Mon, Jul 11, 2011 at 7:10 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:
> +1 on raw SQL in this instance.
Not exactly, using ORM is pretty easy too. You would do something like this:
results.extra(select={
'distance':
'(acos
+1 on raw SQL in this instance.
On Mon, Jul 11, 2011 at 2:36 AM, Jian Chang wrote:
> Using raw sql is a better idea
>
>
> 2011/7/11 Jonas Geiregat
>
>>
>>
>> In order to find the places in near by area I want to make following
>> mysql query. but I am not sure how should I translate it using dj
Using raw sql is a better idea
2011/7/11 Jonas Geiregat
>
>
> In order to find the places in near by area I want to make following
> mysql query. but I am not sure how should I translate it using django
> models and managers.
>
>
> You could execute the raw sql query string, see:
> https://docs.
>
>
> In order to find the places in near by area I want to make following
> mysql query. but I am not sure how should I translate it using django
> models and managers.
You could execute the raw sql query string, see:
https://docs.djangoproject.com/en/dev/topics/db/sql/
for more information on
Hey All,
I am quite new to Django and recently started using django for
developing a location based service.
In order to find the places in near by area I want to make following
mysql query. but I am not sure how should I translate it using django
models and managers.
orig.lat = x
orig.lon = y
"
13 matches
Mail list logo