|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
[Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
----------------------------------------------+----------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Keywords: Stage: Unreviewed | Has_patch: 1 ----------------------------------------------+----------------------------- At present, django updates every single field when saving - this can be less than desirable performance-wise if you only need to update 1 or 2, and can help avoid some minor threading issues. (two functions that never edit the same columns can never conflict with each other using this) This patch allows you to specify which columns should be saved, and the rest are left as they currently are in the database. Example: {{{ >>> p = Poll.objects.get(pk=1) >>> p.question = "How can we help you?" >>> p.save(['question']) # or p.save(save_fields=['question']) }}} The SQL generated is then only touching the question: 'UPDATE "polls_poll" SET "question"=How can we help you? WHERE "id"=1' (from connection.queries, which is why the quoting isn't complete) -- Ticket URL: <http://code.djangoproject.com/ticket/4102> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 1 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Changes (by Simon G. <dev@...>): * needs_better_patch: => 0 * stage: Unreviewed => Design decision needed * needs_tests: => 1 * needs_docs: => 1 Comment: I like this functionality for the stated performance reasons, but I can't help thinking that this could be done automatically by just looking for anything that's changed (although the tracking of before and after states may be more trouble than it's worth!). If accepted, this would need a brief bit of documentation for database-api too (just a description and an example). Some tests would be good too. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:1> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 1 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by mtredinnick): Simon, tracking "before" vs. "after" states can't really be done automatically, since we would have to trap every attribute access to the class (which are, after all, just normal Python attribute accesses). Doing an extra database lookup to work out this information would also be bad. I'm slightly in favour of this feature at the moment, but still thinking about it. I think it would need to be implemented with a manual list of the fields, as in Collin's patc if we did it. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:2> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 1 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by Paul Smith <paulsmith@...>): I've uploaded a patch based on Collin's original (using {{{only_fields}}} instead of {{{save_fields}}} as the keyword argument -- this implies a possible {{{except_fields}}} keyword argument, or perhaps {{{exclude=False|True}}} which defaults to {{{False}}}), including unit tests and docs. Should an exception be thrown if invalid field names are given in the list? -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:3> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 1 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by Collin Grady <cgrady@...>): This came up again at work and it was mentioned that you should be able to override `__setattr__` for the meta class to trap attribute changes and set a dirty flag for various columns, which could enable some automation of this. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:4> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 1 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by Collin Grady <cgrady@...>): Found another issue in the previous patches - if you created an object, for instance {{{Poll(id=1, question='What color is the sky?')}}} and then tried to save it, it would not recognize that you had modified those attributes. Added a kwarg to {{{__init__}}} to decide if the dirty flags should be washed at the end of {{{__init__}}}, and modified the model creation in {{{query.py}}} to use the flag, so that queries from the database are not flagged as dirty, but manual object creation can be done either way. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:5> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Changes (by SmileyChris): * needs_tests: 1 => 0 Comment: This is looking nice and shiny. With some docs, it'd be ready for core IMO. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:6> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by SmileyChris): [http://groups.google.com/group/django- developers/browse_thread/thread/ca0c34042d03586b#77e1147b1e6ac86a Malcolm asked about] the performance impact. It doesn't look good. Here's a quick mock test I created: {{{ >>> from timeit import Timer # A control model >>> setup_a = ''' class Model(object): pass m = Model() ''' # A model which has a __setattr__ which does nothing >>> setup_b = ''' class Model(object): def __setattr__(self, name, value): super(Model, self).__setattr__(name, value) m = Model() ''' # A model which has a __setattr__ which matches this patch >>> setup_c = ''' class Model(object): def __setattr__(self, name, value): if name != '_modified_attrs' and (not hasattr(self, name) or value != getattr(self, name)): if hasattr(self, '_modified_attrs'): if value not in self._modified_attrs: self._modified_attrs.add(name) else: self._modified_attrs = set((value,)) super(Model, self).__setattr__(name, value) m = Model() ''' >>> Timer('m.an_attribute="test"', setup_a).timeit() 0.17214338693884201 >>> Timer('m.an_attribute="test"', setup_b).timeit() 1.6591357281431556 >>> Timer('m.an_attribute="test"', setup_c).timeit() 2.6405875607088092 }}} -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:7> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by Brian Rosner <brosner@...>): I would think by doing value comparisons on the data is a main cause for the overhead. To mark something dirty do it based on the setting of the attribute only and not based on what data is being changed. If I am having to update a model with a 3.4 MB chunk of data it will be comparing that data with the 3 MB that may already be in there. At that point I don't care about only updating the fields I change since it will take much more time than just updating it. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:8> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by SmileyChris): More performance checks: {{{ # A model which has a __setattr__ which *really* matches this patch >>> setup_c = ''' class Model(object): def __setattr__(self, name, value): if name != '_modified_attrs': if hasattr(self, '_modified_attrs'): if name not in self._modified_attrs: self._modified_attrs.add(name) else: self._modified_attrs = set((name,)) super(Model, self).__setattr__(name, value) m = Model() ''' # Optimized for speed, and dropped the value check as Brian suggested >>> setup_d = ''' class Model(object): def __setattr__(self, name, value): try: if name not in self._modified_attrs: self._modified_attrs.add(name) except AttributeError: if name != '_modified_attrs': self._modified_attrs = set((name,)) super(Model, self).__setattr__(name, value) m = Model() ''' >>> Timer('m.an_attribute="test"', setup_a).timeit() 0.17163466306471914 >>> Timer('m.an_attribute="test"', setup_b).timeit() 1.7086492836380041 >>> Timer('m.an_attribute="test"', setup_c).timeit() 2.3102257409810463 >>> Timer('m.an_attribute="test"', setup_d).timeit() 1.9328342009948187 }}} So `setup_d` is only 13% slower than a plain `__setattr__` override... that's not bad... -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:9> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by SmileyChris): (actually, I dropped the value check in `setup_c` too, so it's still more like 2.71 for the speed of a `__setattr__` which matches the current patch) -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:10> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: adrian Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by Collin Grady <cgrady@...>): Attached the earlier tests (slightly corrected) - it seems that the majority of the extra time used is merely from defining {{{__setattr__}}}, strangely enough... Results of script, showing single vs double: {{{ Single Assignment Control: 0.29817199707 noop: 1.92452192307 patch: 3.07881999016 optimized: 2.29438686371 Double Assignment Control: 0.298352003098 Noop: 1.92282295227 Patch: 3.08132410049 Optimized: 2.29805707932 }}} The odd thing (to me at least) is that the set creation doesn't appear to take any more time than simply adding a value to the set (as shown by how the 2nd assignment takes just as long as the first). If the performance difference caused by the {{{__setattr__}}} stuff is too much, I think the original manual idea of being able to specify save/exclude fields in {{{save()}}} could be a decent compromise. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:11> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: nobody Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by anonymous): BTW the latest patch obviously is very backwards-incompatible for anyone using obj.__dict__.update() to update a lot of attributes at once, or using obj.__dict__.update(form.cleaned_data) as I've seen on a few blog posts. -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:12> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: nobody Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by SmileyChris): Replying to [comment:11 Collin Grady <cgrady@...>]: > The odd thing (to me at least) is that the set creation doesn't appear to take any more time than simply adding a value to the set (as shown by how the 2nd assignment takes just as long as the first). It's because you were doing it in set up, not in the actual test! Results of script: {{{ Single Assignment Control: 0.168 noop: 1.689 (10.0x) patch: 2.581 (15.3x) optimized: 1.872 (11.1x) property: 1.494 (8.9x) Double Assignment Control: 0.368 noop: 3.400 (9.2x) patch: 5.222 (14.2x) optimized: 3.887 (10.6x) property: 2.951 (8.0x) }}} -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:13> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: nobody Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by SmileyChris): Ok, so I've got the timing down to under 6x control. I think it's also important to mention that the writing of an attribute isn't really where most of the time is going to be taken up anyway - it's not like this is slowing down model access or saving by any real measure. {{{ Single Assignment Control: 0.170 noop: 1.939 (11.4x) patch: 2.566 (15.1x) optimized: 1.852 (10.9x) noop-h-op: 0.787 (4.6x) h-optimiz: 0.988 (5.8x) property: 1.473 (8.6x) new-attr: 1.779 (10.4x) Retreiving Control: 0.139 noop: 0.137 (1.0x) patch: 0.177 (1.3x) optimized: 0.162 (1.2x) noop-h-op: 0.136 (1.0x) h-optimiz: 0.135 (1.0x) property: 0.787 (5.7x) new-attr: 0.992 (7.2x) }}} -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:14> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: nobody Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by andraz@...): Two things: 1. while you are overloading setattr, you could also add an option to allow only defined fields to be set and rising exception on setting nonexistent field. This is a great debugging mechanism to weed out incidental typos which usually lead to quiet dataloss until you notice it at some time much too late. 2. Are you really sure you should optimize for form-update when saving on- change - and thus needing a compare? I don't really believe that is the case which people need this db performance advantage for... Usually save() gets performance-problematic when you want to change your data in bulk... and you just need to update a counter or a date field for thousands of records, but don't want to touch all the textfields -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:15> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: nobody Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Comment (by SmileyChris): Replying to [comment:15 andraz@...]: > Two things: > 1. while you are overloading setattr, you could also add an option to allow only defined fields to be set and rising exception on setting nonexistent field. That is well outside of the scope of this ticket. > 2. Are you really sure you should optimize for form-update when saving on-change - and thus needing a compare? You're not being very clear, but I think you are asking why I re- implemented the change to check against existing values. The point in that change isn't optimization but to help with the minor threading issues. And I think you may have overlooked the fact that it only does this comparison for fields when they are being set to ensure they really are "changing". -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:16> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django Code] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
-------------------------------------------------+-------------------------- Reporter: Collin Grady <cgrady@...> | Owner: nobody Status: new | Component: Database wrapper Version: SVN | Resolution: Keywords: | Stage: Design decision needed Has_patch: 1 | Needs_docs: 1 Needs_tests: 0 | Needs_better_patch: 0 -------------------------------------------------+-------------------------- Changes (by Yopi <yannvr@...>): * cc: yannvr@... (added) -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:17> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates-unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
--------------------------------------------------------+------------------- Reporter: Collin Grady <cgrady@...> | Owner: cgrady Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Resolution: | Keywords: Stage: Design decision needed | Has_patch: 1 Needs_docs: 1 | Needs_tests: 0 Needs_better_patch: 0 | --------------------------------------------------------+------------------- Changes (by Richard Davies <richard.davies@...>): * cc: richard.davies@... (added) -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:33> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: [Django] #4102: Allow UPDATE of only specific fields in model.save()
by noreply-71
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message #4102: Allow UPDATE of only specific fields in model.save()
--------------------------------------------------------+------------------- Reporter: Collin Grady <cgrady@...> | Owner: cgrady Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Resolution: | Keywords: Stage: Design decision needed | Has_patch: 1 Needs_docs: 1 | Needs_tests: 0 Needs_better_patch: 0 | --------------------------------------------------------+------------------- Changes (by Brian Harring <ferringb@...>): * cc: ferringb@... (removed) -- Ticket URL: <http://code.djangoproject.com/ticket/4102#comment:34> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@... To unsubscribe from this group, send email to django-updates+unsubscribe@... For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~--- |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |