Re: Profiling Django (WAS Django database-api)

2012-04-04 Thread Javier Guerra Giraldez
On Wed, Apr 4, 2012 at 4:07 AM, Tom Evans wrote: > One pretty cool method I've used for live debugging in the past is to > 'log' to rabbitmq (Note - not celery - raw amqp), and send messages to > a logging exchange. You can use a topic key so that different > processes can be distinguished. a sim

Re: Profiling Django (WAS Django database-api)

2012-04-04 Thread Tom Evans
On Tue, Apr 3, 2012 at 11:25 PM, Andre Terra wrote: > Hey Javier, > > Thanks for the reply. My problem with the logs in the past was that they > tended to make the task even slower (due to recursion) but I guess that's > probably because I didn't call the logging from the appropriate places in > t

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Javier Guerra Giraldez
On Tue, Apr 3, 2012 at 5:25 PM, Andre Terra wrote: > To make things a little more complicated, the task involves writing a large > amount of data to a temp database, handling it and then saving some > resulting queries to the permanent DB. This makes it a tad harder to analyze > what goes on in th

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
Hey Javier, Thanks for the reply. My problem with the logs in the past was that they tended to make the task even slower (due to recursion) but I guess that's probably because I didn't call the logging from the appropriate places in the code. To make things a little more complicated, the task inv

Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Javier Guerra Giraldez
On Tue, Apr 3, 2012 at 8:21 AM, Andre Terra wrote: > I have some complex and database intensive asynchronous tasks running under > celery which take a LONG time to complete and I'd just love to be able to > keep track of the queries they generate in order to optimize and possibly > remove the bigg

Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
While I know of the two methods mentioned by Anssi, I've often wondered how to profile my code from a project level. I have some complex and database intensive asynchronous tasks running under celery which take a LONG time to complete and I'd just love to be able to keep track of the queries they

Re: Django database-api

2012-04-03 Thread KasunLak
Hi, Thanks you very much for the informative answer! It clears all the questions I had in my mind. Because I have some idea to build a tool to draw the model (UML) --> Generate Django Model code --> and then we can deploy it to db. Moreover I was thinking that if it possible to customize (edit exi

Re: Django database-api

2012-04-03 Thread akaariai
On Apr 3, 11:27 am, KasunLak wrote: > Hi, > > No, sorry for not giving more details. What I am asking is once we > syncdb the generated scripts (create table). Can we see the method > implementation of database access api? > > For example: If we have created and deployed a model called Poll > (tut

Re: Django database-api

2012-04-03 Thread KasunLak
Hi, No, sorry for not giving more details. What I am asking is once we syncdb the generated scripts (create table). Can we see the method implementation of database access api? For example: If we have created and deployed a model called Poll (tutorial example in django site) p = Poll.objects.get

Re: Django database-api

2012-04-03 Thread Eugenio Minardi
Hi, Do you mean the SQL generated by your model? In this case you can use python manage.py sql APPNAME On Tue, Apr 3, 2012 at 8:45 AM, KasunLak wrote: > Hi all, > > I just wonder is there a way to browse/view the code of database api > methods generated? Is there any tool for this? > > Thanks

Django database-api

2012-04-02 Thread KasunLak
Hi all, I just wonder is there a way to browse/view the code of database api methods generated? Is there any tool for this? Thanks in advance, Kasun -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us

Re: Smaller Than in Django database API

2010-10-11 Thread Jonathan Barratt
Ah, most enlightening and makes perfect sense, thanks Tom! ? 11 ?.?. 2553 21:45 Tom Evans ?: > 2010/10/11 Jonathan Barratt : >> On 11 ?.?. 2010, at 21:05, Sithembewena Lloyd Dube wrote: >> Note also that, AFAIK, multiple where criteria are accomplished by chaining >> filters rather than

Re: Smaller Than in Django database API

2010-10-11 Thread Sithembewena Lloyd Dube
@Jonathan, thanks. That does the trick. @Tom, thanks for bringing the subtle, yet important, difference between the two forms of that expression to my attention. 2010/10/11 Tom Evans > 2010/10/11 Jonathan Barratt : > > On 11 ?.?. 2010, at 21:05, Sithembewena Lloyd Dube wrote: > > Note also that

Re: Smaller Than in Django database API

2010-10-11 Thread Tom Evans
2010/10/11 Jonathan Barratt : > On 11 ?.?. 2010, at 21:05, Sithembewena Lloyd Dube wrote: > Note also that, AFAIK, multiple where criteria are accomplished by chaining > filters rather than providing them as a list to one filter call. > But I am new to Django myself, so if anyone corrects this advi

Re: Smaller Than in Django database API

2010-10-11 Thread Jonathan Barratt
On 11 ?.?. 2010, at 21:05, Sithembewena Lloyd Dube wrote: > Hi all, > > How does one filer objects by "smaller than" criteria in the data access API? > For example, in the following line: I believe it's by appending the field name with _lte > MySite.objects.filter(rank < 11, display_on_site =

Smaller Than in Django database API

2010-10-11 Thread Sithembewena Lloyd Dube
Hi all, How does one filer objects by "smaller than" criteria in the data access API? For example, in the following line: MySite.objects.filter(*rank < 11*, display_on_site = 1).order_by('rank') - how would one handle the highlighted criterion? Thanks. -- Regards, Sithembewena Lloyd Dube http:

Django Database API in standalone mode

2010-05-09 Thread Ozgur Yılmaz
Hi everybody, I'm writing an open source asset,resource and project manager for animation and vfx studios. And I want to use Django's database api to handle all the db stuff. In my system every project is going to have its own database (probably sqlite3 files in project root folder). So what is th

Re: Problem using django database API

2008-01-25 Thread [EMAIL PROTECTED]
That would be User_Friend.objects.filter(from_user=user, active=True, to_user__name__startswith=q) On Jan 25, 12:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I need help making a query with django with I'm not sure it's > possible. > > I have > > model: > class User_Friend(m

Problem using django database API

2008-01-25 Thread [EMAIL PROTECTED]
Hello, I need help making a query with django with I'm not sure it's possible. I have model: class User_Friend(models.Model): from_user = models.ForeignKey(User, related_name='from_user') to_user = models.ForeignKey(User, null=True, related_name='to_user') active = models.BooleanFie

Re: Django database API - What is it good for?

2007-08-13 Thread TheMaTrIx
Also, if I'm not mistaken, when you use the database api, the input validation steps are taken care of by the framework, you don't just tell in the models what format fields should be in the database, but at the same time are telling the framework what input it should accept for that field. If a f

Re: Django database API - What is it good for?

2007-08-13 Thread Collin Grady
> >>> users = User.objects.filter(groups__contains="Staff") ? This line doesn't work because "groups" is a ManyToManyField, not a CharField, so __contains="Staff" doesn't make any sense. Something like users = User.objects.filter(groups__name="Staff") should work a little better :) --~--~-

Re: Django database API - What is it good for?

2007-08-13 Thread James Bennett
On 8/13/07, Amirouche <[EMAIL PROTECTED]> wrote: > What do you mean, I can't understand. OK, suppose you are running an online store, so you have a database table "orders", which lists orders customers have placed, and another "addresses" which lists the addresses to ship the orders to. To calcul

Re: Django database API - What is it good for?

2007-08-13 Thread Amirouche
On Aug 13, 3:19 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 8/13/07, sagi s <[EMAIL PROTECTED]> wrote: > > > Surely not. It is... darn - Can I just use SQL and be done with it? > > Of course. > > But keep in mind that, when programming in an object-oriented > language, it's often more us

Re: Django database API - What is it good for?

2007-08-13 Thread James Bennett
On 8/13/07, sagi s <[EMAIL PROTECTED]> wrote: > Surely not. It is... darn - Can I just use SQL and be done with it? Of course. But keep in mind that, when programming in an object-oriented language, it's often more useful to get back a set of domain-specific objects -- which requires using Djang

Django database API - What is it good for?

2007-08-13 Thread sagi s
I've been playing around with Django for a couple of weeks. I'm finding myself spending most of my type tinkering with the Database API to try to wrestle the information I need out of my database. At this point it looks to me like I have replaced one set of incantations (SQL) for another (Databa

Re: Nested Relationships between tables in Django Database API

2006-12-09 Thread Russell Keith-Magee
On 12/10/06, Darin Lee <[EMAIL PROTECTED]> wrote: > In the console, if I populate the Contest, the instance produces a > "category_set" method/property (as expected and documented). However, > if you "dir(c.category_set)" there is no "finalist_set" method/ > property in the category_set's namespac

Nested Relationships between tables in Django Database API

2006-12-09 Thread Darin Lee
Hi All, Just curious, does the Django Database API support nested relationships more than one level deep? It's starting to look like it doesn't... for example, let's say I have three tables: Contest, Categories, and Finalists; related as such: Contest, Category foreign