I think I spotted something weird. May be someone could explain that?

1. In Django 1.2 define two DBs (let it be sqlite), one of which name
'test'.
2. Define DB router for 'testapp' so that it always uses 'test' DB.
3. Use 'commit_manually' decorator for 'test' view.
4. In 'test' view define 'cursor' pointing to 'test' DB.
5. Execute some INSERTs and commit
*. 'Samples' object (exported from model) would show all inserted
object, but nothing would be written into DB.

@transaction.commit_manually(using='test')

def test(request):



    print Samples.objects.all()



    cursor = connections['test'].cursor()



    cursor.execute("PRAGMA temp_store=MEMORY")

    cursor.execute("PRAGMA synchronous=OFF")



    for i in range(1, 25):

        cursor.execute("INSERT INTO testapp_samples (simplefield)
VALUES (%s);", [i])



    transaction.commit()



    print Samples.objects.all()



    raise Http404

-- 
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.

Reply via email to