Skip to content

Commit

Permalink
Don't create a new MetaData in LazyMapperCollection,
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vincentfretin committed Aug 28, 2009
1 parent faf92f7 commit 568375e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
@@ -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.

Expand Down
4 changes: 2 additions & 2 deletions src/z3c/sqlalchemy/mapper.py
Expand Up @@ -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

Expand Down Expand Up @@ -131,7 +131,7 @@ def __init__(self, wrapper):
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()
Expand Down

0 comments on commit 568375e

Please sign in to comment.