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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.