Question for Django ORM developers

2010-02-23 Thread P.R.
Hello, I have question about type of design patterns using in Django ORM. It is: Table Data Gateway, Row Data Gateway, Active Record or Data Mapper? .. Personally I think that it's mix of Row Data Gateway and Data Mapper, but I want to ask You guys for sure :-) Thanks, regards, P.R. -- You

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-16 Thread David Cramer
Per my patches and what I believe Malcom has done with qsrf, the syntax for related fields was field__related__name, and yes, you would repeat this over and over, but it keeps it consistant. I would like a values-like method to return partial objects, and then requesting any field thats not

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-15 Thread Dima Dogadaylo
On 15 Feb, 12:30, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > When Adrian > proposed that API, he realised that almost always you're going to be > pulling back all of the fields or almost all of them. Once a database > has read a row to access some of the data, accessing all of the data in >

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-15 Thread Sebastian Noack
On Fri, 15 Feb 2008 21:30:23 +1100 Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > There's also the fairly pragmatic side-effect that if you are only > pulling back a very few fields, there isn't really a lot your model > methods are going to be able to do without loading more data, unless >

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-15 Thread Sebastian Noack
On Fri, 15 Feb 2008 01:54:24 -0800 (PST) Dima Dogadaylo <[EMAIL PROTECTED]> wrote: > > Of course, this decreases database load, but IMHO it is better to > > use QuerySet.values if you want select just certain values from a > > model. > > Often I need methods defined in models and isn't available

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-15 Thread Malcolm Tredinnick
On Fri, 2008-02-15 at 01:54 -0800, Dima Dogadaylo wrote: > On 14 Feb, 17:26, Sebastian Noack <[EMAIL PROTECTED]> > wrote: > > > > Of course, this decreases database load, but IMHO it is better to use > > QuerySet.values if you want select just certain values from a model. > > Often I need

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-15 Thread Dima Dogadaylo
On 14 Feb, 17:26, Sebastian Noack <[EMAIL PROTECTED]> wrote: > > Of course, this decreases database load, but IMHO it is better to use > QuerySet.values if you want select just certain values from a model. Often I need methods defined in models and isn't available at dictionaries. For example

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-14 Thread Sebastian Noack
> I made a patch for Django to add QuerySet.fields(*fields, > **related_fields) and make possible to load only some from master and > related models fields. It allows to tune various object list queries > when we need only limited subset of all fields, improve general > performance and decrease

Re: Django ORM performance patch. Fixes #5420, #5768

2008-02-14 Thread Malcolm Tredinnick
On Thu, 2008-02-14 at 03:50 -0800, Entropy Hacker wrote: > I made a patch for Django to add QuerySet.fields(*fields, > **related_fields) and make possible to load only some from master and > related models fields. It allows to tune various object list queries > when we need only limited subset

Django ORM performance patch. Fixes #5420, #5768

2008-02-14 Thread Entropy Hacker
I made a patch for Django to add QuerySet.fields(*fields, **related_fields) and make possible to load only some from master and related models fields. It allows to tune various object list queries when we need only limited subset of all fields, improve general performance and decrease database

Re: django ORM

2007-11-22 Thread James Bennett
On 11/22/07, Goutham DL <[EMAIL PROTECTED]> wrote: > Iam new to this community. I would like to know more about the django > ORM(i.e its internal workings). Can someone provide some good links > for this? http://code.djangoproject.com/wiki/DevModelCreation -- "Bu

Re: django ORM

2007-11-22 Thread Goutham DL
I have downloaded the source code and gone through the official documentation :).Iam more interested in how django does the mapping from the code to SQL. Goutham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: django ORM

2007-11-22 Thread SmileyChris
On Nov 23, 8:18 am, Goutham DL <[EMAIL PROTECTED]> wrote: > Hi, > Iam new to this community. I would like to know more about the django > ORM(i.e its internal workings). Can someone provide some good links > for this? Hi Goutham, If you're new to the community, ensu

django ORM

2007-11-22 Thread Goutham DL
Hi, Iam new to this community. I would like to know more about the django ORM(i.e its internal workings). Can someone provide some good links for this? Goutham --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

Re: Django ORM bug when your app has a model named "ContentType"?

2007-03-01 Thread Rob Hudson
> Could this be related to #2874 ? 2874 looks related in that it is another bug resulting from a similar type of circular table relationship. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers"

Re: Django ORM bug when your app has a model named "ContentType"?

2007-02-28 Thread Ramiro Morales
On 2/28/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > [...] > > But! I did find the root of what's causing this bug and it may occur > regardless of the name of the model... > > Our content system has these relationships: > > Content -> ContentType > Content -> Attribute -> ContentType >

Re: Django ORM bug when your app has a model named "ContentType"?

2007-02-28 Thread Rob Hudson
On Feb 9, 3:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > So after some back and forth about whether this should or shouldn't > work, there didn't seem to be any resolution. Your gut feeling looks > right to me Rob: it should probably work as you expect (no collision), > although it

Re: Django ORM bug when your app has a model named "ContentType"?

2007-02-09 Thread Malcolm Tredinnick
On Wed, 2007-01-31 at 17:41 -0800, Rob Hudson wrote: > > Keep in mind that django.contrib.contenttypes gets installed by > > default, and is used by the comments app, the auth app, the admin app > > and the generic relations framework. > > > > It's hard to escape it :) > > I quickly grepped the

Django ORM

2007-02-04 Thread Sergey Kirillov
Greetings, I'd like to ask, why Django ORM has no concept of Identity Map? It is strange for me that if I call get() five times I will get five object instances, instead of five references to a single instance. Was it a design decision? I'm unable to find any discussions of this. Or I'm

Re: Django ORM bug when your app has a model named "ContentType"?

2007-01-31 Thread Brian Beck
Rob Hudson wrote: >> Django has a builtin type called "ContentType", >> http://code.djangoproject.com/browser/django/trunk/django/contrib/con... >> >> I'd just rename yours to something else and be done with it. > > As a workaround, sure. I've already worked around the issue. > > But I don't

Re: Django ORM bug when your app has a model named "ContentType"?

2007-01-31 Thread Jay Parlar
On 1/31/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > > Django has a builtin type called "ContentType", > > http://code.djangoproject.com/browser/django/trunk/django/contrib/con... > > > > I'd just rename yours to something else and be done with it. > > As a workaround, sure. I've already worked

Re: Django ORM bug when your app has a model named "ContentType"?

2007-01-31 Thread Rob Hudson
> Django has a builtin type called "ContentType", > http://code.djangoproject.com/browser/django/trunk/django/contrib/con... > > I'd just rename yours to something else and be done with it. As a workaround, sure. I've already worked around the issue. But I don't think Django would want this

Re: Django ORM bug when your app has a model named "ContentType"?

2007-01-31 Thread Jay Parlar
On 1/30/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > I'm getting a weird bug here and this is what I've deduced... > > I've got a "Page" model and a "Content" model. Content has a FK to > Page. I also have a "ContentType" model and Content has a FK to > ContentType. This is where I tell it if

Django ORM bug when your app has a model named "ContentType"?

2007-01-30 Thread Rob Hudson
I'm getting a weird bug here and this is what I've deduced... I've got a "Page" model and a "Content" model. Content has a FK to Page. I also have a "ContentType" model and Content has a FK to ContentType. This is where I tell it if the content is text or other media content. The problem

Re: Proposal: Database Dumper based on Django ORM

2007-01-16 Thread [EMAIL PROTECTED]
http://simon.net.nz/articles/django-database-export-v1/ is nice :) I was refering to something more than ju a way to make dumps - a dumper which has an admin page where I could select what to dump and other options. --~--~-~--~~~---~--~~ You received this

Re: Proposal: Database Dumper based on Django ORM

2007-01-15 Thread Russell Keith-Magee
On 1/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: My proposal is a database data dumper based on django ORM - It would not produce SQL but python code that would insert the data. Something like (example dump): You might want to check out the phase 3 patches associated with

Re: Proposal: Database Dumper based on Django ORM

2007-01-15 Thread [EMAIL PROTECTED]
I half-wrote something similar (1) to extract some data for an app. It's very preliminary - you'll need to hand-edit the ordering of relationships etc, but you can get a list of the various api save/create commands which will recreate the data. Hope it helps, Simon [1]

Re: Proposal: Database Dumper based on Django ORM

2007-01-14 Thread Honza Král
On 1/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: My proposal is a database data dumper based on django ORM - It would not produce SQL but python code that would insert the data. Something like (example dump): ### from os import environ environ['DJANGO_SETTINGS_

Proposal: Database Dumper based on Django ORM

2007-01-14 Thread [EMAIL PROTECTED]
My proposal is a database data dumper based on django ORM - It would not produce SQL but python code that would insert the data. Something like (example dump): ### from os import environ environ['DJANGO_SETTINGS_MODULE'] = 'settings' from django.contrib.auth.models import User

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-05 Thread DavidA
John Lenton wrote: > > I hadn't even considered having a multi-parameter tuple-returning > "sum"; I was ok with either calling groupby thrice, or saving the > groupby and calling the different ops in sequence. In either case, a > database roundtrip per call. I'm often grouping thousands of rows

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-05 Thread DavidA
Russell Keith-Magee wrote: > annotate() returns a query set, so it can be used multiple times, be > combined with filters, etc. The argument handling strategy employed in > filter() is reused here; kwargs to annotate() can be decomposed on a > __ boundary to describe table joins, with the last

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-05 Thread John Lenton
On 12/4/06, DavidA <[EMAIL PROTECTED]> wrote: > > Would I have to call queryset.groupby(account) three times: once for > count(), once for sum(quantity) and once for sum(total_pnl)? I hadn't even considered having a multi-parameter tuple-returning "sum"; I was ok with either calling groupby

Re: Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-05 Thread Russell Keith-Magee
On 12/4/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > I'm taking this to django-dev for more discussion; it'll get seen by more the > right people there. > > Thoughts, anyone? Ok; here's my thoughts. 1. Introduction ~~~ Consider the following pseudo-model: class Book(Model):

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-04 Thread Jacob Kaplan-Moss
On 12/4/06 3:30 PM, DavidA wrote: > I think it quickly gets more complicated than that syntax would > support. Oh, of *course* it does -- that's why I want to discuss it more! I think, though, that we should be able to find a 80/20 point for aggregates and support most of the common use

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-04 Thread DavidA
Jacob Kaplan-Moss wrote: > No, I think not -- I think that syntax (``queryset.groupby(field).max()``) > actually looks like the best proposal for aggregates I've seen thus far... > > Thoughts, anyone? > > Jacob I think it quickly gets more complicated than that syntax would support. For

Re: Suggestion: Aggregate/Grouping/Calculated methods in Django ORM

2006-12-04 Thread Jacob Kaplan-Moss
On 12/4/06 5:57 AM, John Lenton wrote: > The "max", "min" and other such functions might be a little more > problematic, unless groupby returned, rather than a generic iterator, > a special "queryset group" and give _it_ the max/min/etc methods. This > way it would be clear that max() returns a

<    1   2