Thursday, November 22, 2012

composite primary keys and transaction issue

Since django do not support composite primary keys, I'm forced to use plain SQL queries.

I got two databases defined and when I try to use UPDATE or INSERT, it simply do nothing:

        cursor = connections['foods'].cursor()
        cursor.execute(sql)

I tried transaction.commit()
cursor.db.set_dirty()
transaction.commit_unless_managed()

Nothing helps. Data not saved in database.

I checked if SQL was valid by executing query through postgres shell. It executed successfully.


P.S. I got the following index defined:

    "MeasureWeight_pkey" PRIMARY KEY, btree ("foodCode", measure, amount, "weightGm")


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kb_CT4YKlXUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate