[Checkins] SVN: relstorage/trunk/ Make schema creation / updating configurable.

Martijn Pieters mj at zopatista.com
Mon Feb 28 16:15:06 EST 2011


Log message for revision 120613:
  Make schema creation / updating configurable.
  
  With the create-schema option set to False, you can prevent a schema update. Handy if you use a newer version of RelStorage for certain operations only, such as packing!

Changed:
  U   relstorage/trunk/CHANGES.txt
  U   relstorage/trunk/README.txt
  U   relstorage/trunk/relstorage/component.xml
  U   relstorage/trunk/relstorage/options.py
  U   relstorage/trunk/relstorage/storage.py

-=-
Modified: relstorage/trunk/CHANGES.txt
===================================================================
--- relstorage/trunk/CHANGES.txt	2011-02-28 18:47:19 UTC (rev 120612)
+++ relstorage/trunk/CHANGES.txt	2011-02-28 21:15:06 UTC (rev 120613)
@@ -21,6 +21,10 @@
   the object reference tables; these tables are pack-specific and regular
   ZODB commits never touch these.
 
+- Add an option to control schema creation / updating on startup. Setting the
+  ``create-schema`` option to false will let you use RelStorage without a
+  schema update.
+
 1.5.0b1 (2011-02-05)
 --------------------
 

Modified: relstorage/trunk/README.txt
===================================================================
--- relstorage/trunk/README.txt	2011-02-28 18:47:19 UTC (rev 120612)
+++ relstorage/trunk/README.txt	2011-02-28 21:15:06 UTC (rev 120613)
@@ -538,6 +538,11 @@
         parameter specifies the lock ID. This parameter currently
         applies only to the Oracle adapter.
 
+``create-schema``
+        Normally, RelStorage will create or update the database schema on
+        start-up. Set this option to false if you need to connect to a
+        RelStorage database without automatic creation or updates.
+
 Adapter Options
 ===============
 

Modified: relstorage/trunk/relstorage/component.xml
===================================================================
--- relstorage/trunk/relstorage/component.xml	2011-02-28 18:47:19 UTC (rev 120612)
+++ relstorage/trunk/relstorage/component.xml	2011-02-28 21:15:06 UTC (rev 120613)
@@ -77,6 +77,9 @@
     <key name="commit-lock-id" datatype="integer" required="no">
       <description>See the RelStorage README.txt file.</description>
     </key>
+    <key name="create-schema" datatype="boolean" default="true">
+      <description>See the RelStorage README.txt file.</description>
+    </key>
   </sectiontype>
 
   <sectiontype name="postgresql" implements="relstorage.adapter"

Modified: relstorage/trunk/relstorage/options.py
===================================================================
--- relstorage/trunk/relstorage/options.py	2011-02-28 18:47:19 UTC (rev 120612)
+++ relstorage/trunk/relstorage/options.py	2011-02-28 21:15:06 UTC (rev 120613)
@@ -48,6 +48,7 @@
         self.cache_delta_size_limit = 10000
         self.commit_lock_timeout = 30
         self.commit_lock_id = 0
+        self.create_schema = True
         self.strict_tpc = default_strict_tpc
 
         # If share_local_cache is off, each storage instance has a private

Modified: relstorage/trunk/relstorage/storage.py
===================================================================
--- relstorage/trunk/relstorage/storage.py	2011-02-28 18:47:19 UTC (rev 120612)
+++ relstorage/trunk/relstorage/storage.py	2011-02-28 21:15:06 UTC (rev 120613)
@@ -142,7 +142,7 @@
     # calling the database.
     _batcher_row_limit = 100
 
-    def __init__(self, adapter, name=None, create=True,
+    def __init__(self, adapter, name=None, create=None,
             options=None, cache=None, blobhelper=None, **kwoptions):
         self._adapter = adapter
 
@@ -161,6 +161,8 @@
 
         self._is_read_only = options.read_only
 
+        if create is None:
+            create = options.create_schema
         if create:
             self._adapter.schema.prepare()
 



More information about the checkins mailing list