From e9b2e33f15cd74978ca858e768e9c44abb1d00f3 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 24 Aug 2013 13:55:14 -0400 Subject: - The :class:`.CreateColumn` construct can be appled to a custom compilation rule which allows skipping of columns, by producing a rule that returns ``None``. Also in 0.8.3. --- lib/sqlalchemy/sql/compiler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index dc3d55039..c56ca1ae4 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2178,11 +2178,13 @@ class DDLCompiler(Compiled): for create_column in create.columns: column = create_column.element try: - text += separator - separator = ", \n" - text += "\t" + self.process(create_column, + processed = self.process(create_column, first_pk=column.primary_key and not first_pk) + if processed is not None: + text += separator + separator = ", \n" + text += "\t" + processed if column.primary_key: first_pk = True except exc.CompileError as ce: -- cgit v1.2.1