summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/activemapper.py
diff options
context:
space:
mode:
authorjeff <none@none>2006-04-08 17:11:53 +0000
committerjeff <none@none>2006-04-08 17:11:53 +0000
commitf1d20d73ed5e0457258fe6d89ef0b70d8c1901a4 (patch)
tree3dc928b10e90631b290e734c2b97ee2715cf66a3 /lib/sqlalchemy/ext/activemapper.py
parent954fbf513da85b418e36a141645e6c8debae492d (diff)
downloadsqlalchemy-f1d20d73ed5e0457258fe6d89ef0b70d8c1901a4.tar.gz
Added preliminary support for inheritance.
Diffstat (limited to 'lib/sqlalchemy/ext/activemapper.py')
-rw-r--r--lib/sqlalchemy/ext/activemapper.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/sqlalchemy/ext/activemapper.py b/lib/sqlalchemy/ext/activemapper.py
index fdb796db2..2564373e5 100644
--- a/lib/sqlalchemy/ext/activemapper.py
+++ b/lib/sqlalchemy/ext/activemapper.py
@@ -1,4 +1,4 @@
-from sqlalchemy import objectstore, create_engine, assign_mapper, relation, mapper
+from sqlalchemy import objectstore, create_engine, assign_mapper, relation, mapper, join
from sqlalchemy import and_, or_
from sqlalchemy import Table, Column, ForeignKey
from sqlalchemy.ext.proxy import ProxyEngine
@@ -25,8 +25,6 @@ class column(object):
self.colname = colname
self.foreign_key = foreign_key
self.primary_key = primary_key
-# self.unique = kwargs.pop( 'unique', None )
-# self.index = kwargs.pop( 'indexed', None )
self.kwargs = kwargs
self.args = args
@@ -84,7 +82,8 @@ def process_relationships(klass, was_deferred=False):
private=reldesc.private,
lazy=reldesc.lazy,
uselist=reldesc.uselist)
- assign_mapper(klass, klass.table, properties=relations)
+ assign_mapper(klass, klass.table, properties=relations,
+ inherits=getattr(klass, "_base_mapper", None))
if was_deferred: __deferred_classes__.remove(klass)
if not was_deferred:
@@ -128,17 +127,18 @@ class ActiveMapperMeta(type):
primary_key=value.primary_key,
*value.args, **value.kwargs)
columns.append(col)
-# if value.indexed:
-# # create a Index object for the column
-# index= Index( "%s_idx" % (value.colname or name),
-# col, unique= value.unique )
continue
if isinstance(value, relationship):
relations[name] = value
assert _engine is not None, "No engine specified"
cls.table = Table(table_name, _engine, *columns)
- assign_mapper(cls, cls.table)
+ # check for inheritence
+ if hasattr( bases[0], "mapping" ):
+ cls._base_mapper= bases[0].mapper
+ assign_mapper(cls, cls.table, inherits=cls._base_mapper)
+ else:
+ assign_mapper(cls, cls.table)
cls.relations = relations
ActiveMapperMeta.classes[clsname] = cls