have you found it yet ? http://www.sqlalchemy.org/docs/reference/ext/compiler.html?highlight=compiler#module-sqlalchemy.ext.compiler
On Jul 20, 2010, at 2:12 PM, Mike Lewis wrote: > I'm not familiar with the compiler extension. Could you elaborate? > > (my temporary solution is monkey patching that function into > PGDDLCompiler (it feels dirty, like ruby programming)) > > Thanks, > Mike > > > On Jul 20, 7:47 am, Michael Bayer <mike...@zzzcomputing.com> wrote: >> why not use the compiler extension ? >> >> On Jul 20, 2010, at 3:07 AM, Mike Lewis wrote: >> >> >> >>> I figured that I need to extend a dialect. Would having something >>> similar to (still a rough version) added to the postgresql dialect be >>> an option?: >> >>> def post_create_table(self, table): >>> """Build table-level CREATE options like TABLESPACE.""" >> >>> table_opts = [] >> >>> inherits = table.kwargs.get('postgresql_inherits') >>> if inherits is not None: >>> if not isinstance(inherits, (list, tuple)): >>> inherits = (inherits,) >>> table_opts.append( >>> '\nINHERITS ( ' + >>> ', '.join(isinstance(i, basestring) and i >>> or self.process(i) >>> for i >>> in inherits) + >>> ' )') >> >>> on_commit = table.kwargs.get('postgresql_on_commit') >>> if on_commit: >>> table_opts.append( >>> '\nON COMMIT ' + >>> on_commit.upper().replace('_', ' ')) >> >>> with_oids = table.kwargs.get('postgresql_with_oids') >>> if with_oids is not None: >>> if with_oids: >>> w = 'WITH' >>> else: >>> w = 'WITHOUT' >>> table_opts.append('\n%s OIDS' % w) >> >>> tablespace = table.kwargs.get('postgresql_tablespace') >>> if tablespace: >>> table_opts.append('\nTABLESPACE ' + tablespace) >> >>> return ''.join(table_opts) >> >>> Thanks, >>> Mike >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "sqlalchemy" group. >>> To post to this group, send email to sqlalch...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> sqlalchemy+unsubscr...@googlegroups.com. >>> For more options, visit this group >>> athttp://groups.google.com/group/sqlalchemy?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.