Re: Operate with Postgresql from Django views.
Yes, this was the problem, thanks for your help. 2009/12/21 Christophe Pettus > > On Dec 21, 2009, at 1:34 AM, NMarcu wrote: > > Everything is OK, if the view is finished, but if after this line I > > add an infinite loop, and in this time I check that table from console > > for the new record, that is not there. > > This sounds like a transaction issue. In the standard Django > transaction handling model, the transaction is not committed until the > view function returns; this means that if you check immediately after > the data modification statement, but before the view function has > completed, you won't see the new data from a different database > connection. > > It's probably not a great idea to idle in a view function, waiting for > a daemon to complete some background process, since the process isn't > really "background" then; the user at the browser is going to be > waiting until the daemon process completes. If you *must* handle it > this way, you can switch to doing manual transaction control instead > of using Django's transaction management. > -- > -- Christophe Pettus >x...@thebuild.com > > -- > > 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...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > -- All the best, Nicolae MARCU -- 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...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Operate with Postgresql from Django views.
On Dec 21, 2009, at 1:34 AM, NMarcu wrote: > Everything is OK, if the view is finished, but if after this line I > add an infinite loop, and in this time I check that table from console > for the new record, that is not there. This sounds like a transaction issue. In the standard Django transaction handling model, the transaction is not committed until the view function returns; this means that if you check immediately after the data modification statement, but before the view function has completed, you won't see the new data from a different database connection. It's probably not a great idea to idle in a view function, waiting for a daemon to complete some background process, since the process isn't really "background" then; the user at the browser is going to be waiting until the daemon process completes. If you *must* handle it this way, you can switch to doing manual transaction control instead of using Django's transaction management. -- -- Christophe Pettus x...@thebuild.com -- 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...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Operate with Postgresql from Django views.
Hello, I have a problem, or I don't know how is working. I want to do an operation to a table, on Postgresql database. By example: I want to add new data in a table. I do it like this: ob_device = Device(id=device_address) ob_device.save() Everything is OK, if the view is finished, but if after this line I add an infinite loop, and in this time I check that table from console for the new record, that is not there. I do this exercise, because I have a daemon that works with my table. When I add from views some data in a table, the daemon update another table, depend of my data. But the problem is that I need to access that update in the same views. I set a flag to wait the daemon to do his job, but that is not set...means daemon, wait the view to be completed, or something like this. What is the problem? Hope I was clear with explanation. -- 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...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.