diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-07-14 20:06:09 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-07-14 20:06:09 +0000 |
commit | bc6fbfa84ab6e1e9639e00cc23b3c41ab1d30dc1 (patch) | |
tree | 41cbfd1293b4413890d372b76f31209b1c793d09 /test/sql/indexes.py | |
parent | e58578cb4b5e96c2c99e84f6f67a773d168b8bd1 (diff) | |
download | sqlalchemy-bc6fbfa84ab6e1e9639e00cc23b3c41ab1d30dc1.tar.gz |
overhaul to schema, addition of ForeignKeyConstraint/
PrimaryKeyConstraint objects (also UniqueConstraint not
completed yet). table creation and reflection modified
to be more oriented towards these new table-level objects.
reflection for sqlite/postgres/mysql supports composite
foreign keys; oracle/mssql/firebird not converted yet.
Diffstat (limited to 'test/sql/indexes.py')
-rw-r--r-- | test/sql/indexes.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/sql/indexes.py b/test/sql/indexes.py index ec72beda3..e9af301de 100644 --- a/test/sql/indexes.py +++ b/test/sql/indexes.py @@ -5,16 +5,33 @@ import sys class IndexTest(testbase.AssertMixin): def setUp(self): - global metadata - metadata = BoundMetaData(testbase.db) + global metadata + metadata = BoundMetaData(testbase.db) self.echo = testbase.db.echo self.logger = testbase.db.logger def tearDown(self): testbase.db.echo = self.echo testbase.db.logger = testbase.db.engine.logger = self.logger - metadata.drop_all() + metadata.drop_all() + def test_constraint(self): + employees = Table('employees', metadata, + Column('id', Integer), + Column('soc', String(40)), + Column('name', String(30)), + PrimaryKeyConstraint('id', 'soc') + ) + elements = Table('elements', metadata, + Column('id', Integer), + Column('stuff', String(30)), + Column('emp_id', Integer), + Column('emp_soc', String(40)), + PrimaryKeyConstraint('id'), + ForeignKeyConstraint(['emp_id', 'emp_soc'], ['employees.id', 'employees.soc']) + ) + metadata.create_all() + def test_index_create(self): employees = Table('employees', metadata, Column('id', Integer, primary_key=True), |