Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4240786
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:12:47+00:00 2026-05-21T03:12:47+00:00

So say I have Klass as a Django model. k = Klass.objects.get(id=1) k.attr1 =

  • 0

So say I have Klass as a Django model.

k = Klass.objects.get(id=1)

k.attr1 = k.attr1
k.attr2 = k.attr2
...

k.save()

Assuming the values are all the same, will Django’s ORM generate an SQL call?

(My application is batch processing some models in a delayed job. It sets them all from a CSV, and if they’re the same values it just saves, currently. I just want to know if I should spend time working on some hash mechanism or logic to detect if they’re the same)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:12:48+00:00Added an answer on May 21, 2026 at 3:12 am

    Why didn’t you try it in the shell? Use django.db.connection.queries to list all the db operations that have been done in that session.

    If you do, you’ll see that it does indeed generate a db hit. In fact, you don’t even need to set any attributes – just calling save() on a freshly loaded model instance will do the trick. Django model instances don’t have any concept of ‘dirtiness’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a class named Klass , and a class called Klass2
Let's say have a string... String myString = my*big*string*needs*parsing; All I want is to
Lets say have this immutable record type: public class Record { public Record(int x,
Let's say have something like: SELECT energy_produced, energy_consumed, timestamp1 AS timestamp FROM ( SELECT
For the sake of argument, let's just say I have to create a local
I have a table which needs 2 fields. One will be a foreign key,
say I have the following function: function checkPanes() { activePane = ''; var panels
Say i have 3 paragraphs, not necessarily paragraph tags. The word Wonderland shows up
Say I have a = [1,2,3] b = [foo(x) for x in a] Now
Say I have a table products and I would like to check if this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.