From: Mike Bayer Date: Sat, 17 Feb 2007 02:39:28 +0000 (+0000) Subject: - moved change for [ticket:466] to ansisql, since thats the syntax for all databases. X-Git-Tag: rel_0_3_5~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e5eeb064a471269041cb12ad95f413ff9aee9c6;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - moved change for [ticket:466] to ansisql, since thats the syntax for all databases. the change is across all dialects, not just oracle --- diff --git a/CHANGES b/CHANGES index 1862260513..4cdf2ec4ee 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ can handle *args or a list instance for positional, **kwargs or a dict instance for named args, or a list of list or dicts to invoke executemany() - small fix to BoundMetaData to accept unicode or string URLs + - fixed named PrimaryKeyConstraint generation [ticket:466] courtesy andrija at gmail - orm: - another refactoring to relationship calculation. Allows more accurate ORM behavior with relationships from/to/between mappers, particularly polymorphic mappers, @@ -47,7 +48,6 @@ - sequences on a non-pk column will properly fire off on INSERT - added PrefetchingResultProxy support to pre-fetch LOB columns when they are known to be present, fixes [ticket:435] - - fixed named PrimaryKeyConstraint generation [ticket:466] courtesy andrija at gmail - mysql: - fix to reflection on older DB's that might return array() type for "show variables like" statements diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py index 974319845d..6cb57e1489 100644 --- a/lib/sqlalchemy/ansisql.py +++ b/lib/sqlalchemy/ansisql.py @@ -746,9 +746,10 @@ class ANSISchemaGenerator(ANSISchemaBase): def visit_primary_key_constraint(self, constraint): if len(constraint) == 0: return - self.append(", \n\tPRIMARY KEY ") + self.append(", \n\t") if constraint.name is not None: - self.append("%s " % constraint.name) + self.append("CONSTRAINT %s " % constraint.name) + self.append("PRIMARY KEY ") self.append("(%s)" % (string.join([self.preparer.format_column(c) for c in constraint],', '))) def supports_alter(self): diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py index 2d77946c46..5346c30dad 100644 --- a/lib/sqlalchemy/databases/oracle.py +++ b/lib/sqlalchemy/databases/oracle.py @@ -485,14 +485,6 @@ class OracleSchemaGenerator(ansisql.ANSISchemaGenerator): self.append("CREATE SEQUENCE %s" % self.preparer.format_sequence(sequence)) self.execute() - def visit_primary_key_constraint(self, constraint): - if len(constraint) == 0: - return - self.append(", \n\t") - if constraint.name is not None: - self.append("CONSTRAINT %s " % constraint.name) - self.append("PRIMARY KEY ") - self.append("(%s)" % (string.join([self.preparer.format_column(c) for c in constraint],', '))) class OracleSchemaDropper(ansisql.ANSISchemaDropper): def visit_sequence(self, sequence):