diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-14 21:58:04 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-14 21:58:04 +0000 |
commit | 8340006dd7ed34cf32bbb7f856397d1c7f13d295 (patch) | |
tree | 3429fe31b379b2ccc10e6653e33d4d6d23fd5ae4 /lib/sqlalchemy/databases/postgres.py | |
parent | 5bb47440e03bb6ac0d3bd92eab4a6d69304ff556 (diff) | |
download | sqlalchemy-8340006dd7ed34cf32bbb7f856397d1c7f13d295.tar.gz |
- a fair amount of cleanup to the schema package, removal of ambiguous
methods, methods that are no longer needed. slightly more constrained
useage, greater emphasis on explicitness.
- table_iterator signature fixup, includes fix for [ticket:288]
- the "primary_key" attribute of Table and other selectables becomes
a setlike ColumnCollection object; is no longer ordered or numerically
indexed. a comparison clause between two pks that are derived from the
same underlying tables (i.e. such as two Alias objects) can be generated
via table1.primary_key==table2.primary_key
- append_item() methods removed from Table and Column; preferably
construct Table/Column/related objects inline, but if needed use
append_column(), append_foreign_key(), append_constraint(), etc.
- table.create() no longer returns the Table object, instead has no
return value. the usual case is that tables are created via metadata,
which is preferable since it will handle table dependencies.
- added UniqueConstraint (goes at Table level), CheckConstraint
(goes at Table or Column level) fixes [ticket:217]
- index=False/unique=True on Column now creates a UniqueConstraint,
index=True/unique=False creates a plain Index,
index=True/unique=True on Column creates a unique Index. 'index'
and 'unique' keyword arguments to column are now boolean only; for
explcit names and groupings of indexes or unique constraints, use the
UniqueConstraint/Index constructs explicitly.
- relationship of Metadata/Table/SchemaGenerator/Dropper has been
improved so that the schemavisitor receives the metadata object
for greater control over groupings of creates/drops.
- added "use_alter" argument to ForeignKey, ForeignKeyConstraint,
but it doesnt do anything yet. will utilize new generator/dropper
behavior to implement.
Diffstat (limited to 'lib/sqlalchemy/databases/postgres.py')
-rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index a28a22cd6..dad2d3bff 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -370,7 +370,7 @@ class PGDialect(ansisql.ANSIDialect): colargs= [] if default is not None: colargs.append(PassiveDefault(sql.text(default))) - table.append_item(schema.Column(name, coltype, nullable=nullable, *colargs)) + table.append_column(schema.Column(name, coltype, nullable=nullable, *colargs)) if not found_table: @@ -392,7 +392,7 @@ class PGDialect(ansisql.ANSIDialect): if row is None: break pk = row[0] - table.c[pk]._set_primary_key() + table.primary_key.add(table.c[pk]) # Foreign keys FK_SQL = """ @@ -443,7 +443,7 @@ class PGDialect(ansisql.ANSIDialect): for column in referred_columns: refspec.append(".".join([referred_table, column])) - table.append_item(ForeignKeyConstraint(constrained_columns, refspec, row['conname'])) + table.append_constraint(ForeignKeyConstraint(constrained_columns, refspec, row['conname'])) class PGCompiler(ansisql.ANSICompiler): @@ -502,13 +502,13 @@ class PGSchemaGenerator(ansisql.ANSISchemaGenerator): return colspec def visit_sequence(self, sequence): - if not sequence.optional and not self.engine.dialect.has_sequence(self.connection, sequence.name): + if not sequence.optional and (not self.dialect.has_sequence(self.connection, sequence.name)): self.append("CREATE SEQUENCE %s" % self.preparer.format_sequence(sequence)) self.execute() class PGSchemaDropper(ansisql.ANSISchemaDropper): def visit_sequence(self, sequence): - if not sequence.optional and self.engine.dialect.has_sequence(self.connection, sequence.name): + if not sequence.optional and (self.dialect.has_sequence(self.connection, sequence.name)): self.append("DROP SEQUENCE %s" % sequence.name) self.execute() |