From: Lele Gaifax Date: Mon, 12 May 2008 15:33:55 +0000 (+0000) Subject: Check for the presence of the Firebird generator, when creating/dropping a sequence X-Git-Tag: rel_0_5beta1~98 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=4b6e1a40e5008b369c8da558e51cd8be07cf2c26;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Check for the presence of the Firebird generator, when creating/dropping a sequence --- diff --git a/lib/sqlalchemy/databases/firebird.py b/lib/sqlalchemy/databases/firebird.py index 3377a60048..948e001d53 100644 --- a/lib/sqlalchemy/databases/firebird.py +++ b/lib/sqlalchemy/databases/firebird.py @@ -649,8 +649,9 @@ class FBSchemaGenerator(sql.compiler.SchemaGenerator): def visit_sequence(self, sequence): """Generate a ``CREATE GENERATOR`` statement for the sequence.""" - self.append("CREATE GENERATOR %s" % self.preparer.format_sequence(sequence)) - self.execute() + if not self.checkfirst or not self.dialect.has_sequence(self.connection, sequence.name): + self.append("CREATE GENERATOR %s" % self.preparer.format_sequence(sequence)) + self.execute() class FBSchemaDropper(sql.compiler.SchemaDropper): @@ -659,8 +660,9 @@ class FBSchemaDropper(sql.compiler.SchemaDropper): def visit_sequence(self, sequence): """Generate a ``DROP GENERATOR`` statement for the sequence.""" - self.append("DROP GENERATOR %s" % self.preparer.format_sequence(sequence)) - self.execute() + if not self.checkfirst or self.dialect.has_sequence(self.connection, sequence.name): + self.append("DROP GENERATOR %s" % self.preparer.format_sequence(sequence)) + self.execute() class FBDefaultRunner(base.DefaultRunner):