Thanks! I had actually just arrived at looking at this code:
class PGSchemaGenerator(compiler.SchemaGenerator):
def get_column_specification(self, column, **kwargs):
...snipped...
else:
colspec += " " + column.type.dialect_impl
(self.dialect).get_col_spec()
but hadn't yet made the leap for getting the dialect.
It's all working perfectly now, thanks for your help.
- Nelson
On Aug 12, 8:45 am, "Michael Bayer" <[email protected]> wrote:
> Nelson wrote:
>
> > Michael,
>
> > Looking at some usage links on the Wiki, thanks to your original link,
> > brought up this:
>
> >http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode
>
> > which has this gem of informaton:
>
> > from sqlalchemy.databases import postgres
> > - and -
> > coltypes = dict( (v,k) for k,v in postgres.pg2_colspecs.iteritems() )
>
> > which gives me the conversion I need from a Column()'s type to the
> > correct SQL string for the ALTER TABLE statement. I can leverage that
> > and make it work in my model. Thanks again.
>
> that's not really the best way to go here. in SQLA 0.5, just do this:
>
> engine = create_engine(...)
> dialect = engine.dialect
> print mycolumn.type.dialect_impl(dialect).get_col_spec()
>
> in 0.6 it's easier:
>
> print mycolumn.type.compile(dialect)
>
>
>
> - Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---