Changeset 318
- Timestamp:
- 04/02/08 15:29:51 (5 years ago)
- Location:
- elixir/trunk
- Files:
-
- 3 modified
-
CHANGES (modified) (1 diff)
-
elixir/entity.py (modified) (2 diffs)
-
tests/test_inherit.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/CHANGES
r314 r318 1 0.5.3 2 3 Bug fixes: 4 - Fixed multi-table inheritance when using a non default schema (closes #38) 5 1 6 0.5.2 - 2008-03-28 2 7 -
elixir/trunk/elixir/entity.py
r308 r318 197 197 # key columns 198 198 parent_desc = self.parent._descriptor 199 schema = parent_desc.table_options.get('schema', None) 200 tablename = parent_desc.tablename 201 if schema is not None: 202 tablename = "%s.%s" % (schema, tablename) 199 203 for pk_col in parent_desc.primary_keys: 200 204 colname = options.MULTIINHERITANCECOL_NAMEFORMAT % \ … … 205 209 # a real column object when said column is not yet 206 210 # attached to a table 207 pk_col_name = "%s.%s" % (parent_desc.tablename, 208 pk_col.key) 211 pk_col_name = "%s.%s" % (tablename, pk_col.key) 209 212 fk = ForeignKey(pk_col_name, ondelete='cascade') 210 213 col = Column(colname, pk_col.type, fk, -
elixir/trunk/tests/test_inherit.py
r313 r318 9 9 def setup(): 10 10 metadata.bind = 'sqlite:///' 11 # metadata.bind = 'postgres:// localhost/test'11 # metadata.bind = 'postgres://@/test' 12 12 # metadata.bind.echo = True 13 13 elixir.options_defaults['shortnames'] = True … … 104 104 # enforcing the foreign key constraint cascade rule). 105 105 # assert not B.table.select().execute().fetchall() 106 107 def test_inheritance_wh_schema(self): 108 # I can only test schema stuff on postgres 109 if metadata.bind.name != 'postgres': 110 print "schema test skipped" 111 return 112 113 class A(Entity): 114 using_options(inheritance="multi") 115 using_table_options(schema="test") 116 117 row_id = Field(Integer, primary_key=True) 118 thing1 = Field(String(20)) 119 120 class B(A): 121 using_options(inheritance="multi") 122 using_table_options(schema="test") 123 124 thing2 = Field(String(20)) 125 126 setup_all(True) 106 127 107 128 def test_inverse_matching_on_parent(self):
