Commits

Thomas Weholt committed 2cb894a

Just added some notes on transaction handling.

  • Participants
  • Parent commits 8d92b6c

Comments (0)

Files changed (2)

 DSE - Delayed SQL Executor
 ==========================
 
-Version : 0.5.0
+Version : 0.5.1
 Author : Thomas Weholt <thomas@weholt.org>
 License : GPL v3.0
 Status : Beta
 Release notes
 =============
 
+0.5.1 : just some notes on transaction handling.
+
 0.5.0 :
     - added modelfactory. Upon first import a modelfactory will be created in the DSE module. It`s basically just a
     helper-class containing ModelDelayedExecutor-instances for all models in all apps found in INSTALLED_APPS in
     for item in foobar.objects.all().values():
         item['somevar'] = calculated_value
         dse.modelfactory.foobar.add_item(item)
-    dse.modelfactory.close() # Will trigger one call to cursor.executemany because .objects.values() gives you all the columns.
+    dse.modelfactory.close() # Will trigger one call to cursor.executemany because .objects.values() gives you all the columns.
+
+I`ve recieved some questions about transaction handling. Below is an simple example, but I`m looking into other ways of handling transactions as well::
+
+    from django.db import transaction
+    import dse
+
+    @transaction.commit_manually
+    def some_method():
+        for item in somelist:
+            dse.modelfactory.SomeModel.add_item(
+                  {'some_column': item.some_value, 
+                   'another_column': item.another_value})
+
+        dse.modelfactory.close()
+        transaction.commit()
 from setuptools import setup, find_packages
 
 setup(name='dse',
-      version='0.5.0',
+      version='0.5.1',
       description='DSE - Delayed SQL Executor',
       author='Thomas Weholt',
       author_email='thomas@weholt.org',