+0.2.8
+- eesh ! the tutorial doctest was broken for quite some time.
+- add_property() method on mapper does a "compile all mappers"
+step in case the given property references a non-compiled mapper
+(as it did in the case of the tutorial !)
+
0.2.7
- quoting facilities set up so that database-specific quoting can be
turned on for individual table, schema, and column identifiers when
{python}
>>> metadata.engine.echo = True
>>> users_table.create() # doctest:+ELLIPSIS,+NORMALIZE_WHITESPACE
- CREATE TABLE users(
- user_id INTEGER NOT NULL PRIMARY KEY,
+ CREATE TABLE users (
+ user_id INTEGER NOT NULL,
user_name VARCHAR(40),
- password VARCHAR(10)
+ password VARCHAR(10),
+ PRIMARY KEY (user_id)
)
...
... Column('address_id', Integer, primary_key=True),
... Column('email_address', String(100), nullable=False),
... Column('user_id', Integer, ForeignKey('users.user_id'))).create() # doctest:+ELLIPSIS,+NORMALIZE_WHITESPACE
- CREATE TABLE email_addresses(
- address_id INTEGER NOT NULL PRIMARY KEY,
+ CREATE TABLE email_addresses (
+ address_id INTEGER NOT NULL,
email_address VARCHAR(100) NOT NULL,
- user_id INTEGER REFERENCES users(user_id)
+ user_id INTEGER,
+ PRIMARY KEY (address_id),
+ FOREIGN KEY(user_id) REFERENCES users (user_id)
)
...
this is the 'external' version of the method which is not reentrant."""
if self.__is_compiled:
return self
-
+
+ self._compile_all()
+
+ # if we're not primary, compile us
+ if self.non_primary:
+ self._do_compile()
+ self._initialize_properties()
+
+ return self
+
+ def _compile_all(self):
# compile all primary mappers
for mapper in mapper_registry.values():
if not mapper.__is_compiled:
if not mapper.__props_init:
mapper._initialize_properties()
- # if we're not primary, compile us
- if self.non_primary:
- self._do_compile()
- self._initialize_properties()
-
- return self
-
def _check_compile(self):
if self.non_primary:
self._do_compile()
has already been compiled, then the given MapperProperty is compiled immediately."""
self.properties[key] = prop
if self.__is_compiled:
+ # if we're compiled, make sure all the other mappers are compiled too
+ self._compile_all()
self._compile_property(key, prop, init=True)
def _create_prop_from_column(self, column, skipmissing=False):