heres a diff to get it working. a primary mapper cant inherit from a
non-primary mapper (added an assertion for that), and the primary key
value for the "manager" table already existed (mid=1, uid=1). the
print of the instance key properly reports:
(<class '__main__.Manager'>, (3, 3, 1), None)
--- /Users/classic/Desktop/test_inherit.py 2006-10-28
20:57:56.000000000 -0400
+++ test.py 2006-10-28 21:02:47.000000000 -0400
@@ -60,18 +60,20 @@
p_l_mapper = mapper(Employee, select([employees,
func.max(employees.c.ts).label('ts')],
group_by=[employees.c.uid]).alias('t'),non_primary=True)
-#manager_map = mapper(Manager, managers, inherits=Employee)
-manager_map = mapper(Manager, managers, inherits=p_l_mapper)
+manager_map = mapper(Manager, managers, inherits=Employee)
+#manager_map = mapper(Manager, managers, inherits=p_l_mapper)
session = create_session()
q = session.query(manager_map)
m = q.select()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
-logging.getLogger('sqlalchemy.orm').setLevel(logging.DEBUG)
+#logging.getLogger('sqlalchemy.orm').setLevel(logging.DEBUG)
n = m[0].clone()
n.ts = 3
+n.uid = 19
n.name = 'Tommy'
+print object_mapper(n).identity_key_from_instance(n)
session.save_or_update(n)
session.flush()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sqlalchemy
-~----------~----~----~----~------~----~------~--~---