[Checkins] SVN: z3c.sqlalchemy/branches/1.3/ Don't create a new MetaData in LazyMapperCollection,

Vincent Fretin vincent.fretin at gmail.com
Fri Aug 28 10:27:07 EDT 2009


Log message for revision 103336:
  Don't create a new MetaData in LazyMapperCollection,
  but use the one created in the wrapper.
  In some cases, you could have some tables in the metadata created in the wrapper,
  and some tables in the metadata created in the LazyMapperCollection,
  which gave an error when trying to create relations.
  

Changed:
  U   z3c.sqlalchemy/branches/1.3/CHANGES.txt
  U   z3c.sqlalchemy/branches/1.3/src/z3c/sqlalchemy/mapper.py

-=-
Modified: z3c.sqlalchemy/branches/1.3/CHANGES.txt
===================================================================
--- z3c.sqlalchemy/branches/1.3/CHANGES.txt	2009-08-28 14:18:10 UTC (rev 103335)
+++ z3c.sqlalchemy/branches/1.3/CHANGES.txt	2009-08-28 14:27:07 UTC (rev 103336)
@@ -1,6 +1,12 @@
 1.3.11 (unreleased)
 -------------------
 
+- Don't create a new MetaData in LazyMapperCollection,
+  but use the one created in the wrapper.
+  In some cases, you could have some tables in the metadata created in the wrapper,
+  and some tables in the metadata created in the LazyMapperCollection,
+  which gave an error when trying to create relations.
+
 - When generating the mapper class, make sure table.name is a string.
   It can be unicode when use_unicode=1 with MySQL engine.
 

Modified: z3c.sqlalchemy/branches/1.3/src/z3c/sqlalchemy/mapper.py
===================================================================
--- z3c.sqlalchemy/branches/1.3/src/z3c/sqlalchemy/mapper.py	2009-08-28 14:18:10 UTC (rev 103335)
+++ z3c.sqlalchemy/branches/1.3/src/z3c/sqlalchemy/mapper.py	2009-08-28 14:27:07 UTC (rev 103336)
@@ -14,7 +14,7 @@
 import new
 import threading
 
-from sqlalchemy import Table, MetaData 
+from sqlalchemy import Table 
 from sqlalchemy.orm import mapper, relation, class_mapper
 from sqlalchemy.ext.declarative import DeclarativeMeta
 
@@ -131,7 +131,7 @@
         self._wrapper = wrapper
         self._engine = wrapper.engine
         self._model = wrapper.model or {}
-        self._metadata = MetaData(self._engine)
+        self._metadata = wrapper.metadata
         self._mapper_factory = MapperFactory(self._metadata)
         self._dependent_tables = None
         self._lock = threading.Lock()



More information about the checkins mailing list