Hi devs,
how to get column type from a column instance?
Imagine following table:
RecordTable = Table('t_record', metadata,
Column('record_id', Integer, primary_key = True),
Column('dep', Integer, default=None)
)
I can get my column using:
engine = engine_from_config({
"sqlalchemy.url": "postgresql:///",
"sqlalchemy.convert_unicode": True,
"sqlalchemy.echo": True
}, prefix="sqlalchemy.")
metadata = MetaData()
metadata.bind = engine
column = RecordTable.c.dep
Now I'd like to print (for example) 'column' type for 'engine'. This
is same type which will be used when I use metadata.create_all().
The best I can print is:
print column.type.get_dbapi_type(engine.dialect.dbapi).name
which prints me 'NUMBER', but I'm expecting 'INT' (postgres).
Best regards
Petr Kobalicek
--
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.