On Jun 11, 2010, at 11:17 AM, Michael Bayer wrote: > > On Jun 11, 2010, at 7:46 AM, Witzel, Stefan wrote: > >> Hello, >> >> I'm trying to retrieve some column properties from a oracle database using >> oracle+zxjdbc: >> >> jdbcUrl = >> '%(engine_dialect)s://%(username)s:%(password)s...@%(hostname)s:%(port)d/%(data >> base)s' % connection >> >> engine = sa.create_engine(jdbcUrl) >> >> inspector = sa.engine.reflection.Inspector(engine) > > use Inspector.from_engine(engine) here.
correction, its a slight inaccuracy in how the inspector is doing its work. Just pass a connection, i.e. engine.connect(), to the Inspector, not an engine. We will try to create a fix for this. > > > > > >> tableNames = inspector.get_table_names() >> for tableName in tableNames[:4]: >> columns = inspector.get_columns(tableName) >> print tableName >> for column in columns: >> print " ", column['name'], ': ',str(column['type']) >> >> The program termintes with the exception >> >> Traceback (most recent call last): >> File "oracle-test-b.py", line 23, in <module> >> tableNames = inspector.get_table_names() >> File >> "/usr/local/lib/jython251/Lib/site-packages/sqlalchemy/engine/reflection.py" >> , line 98, in get_table_names >> tnames = self.dialect.get_table_names(self.conn, >> File "<string>", line 1, in <lambda> >> File >> "/usr/local/lib/jython251/Lib/site-packages/sqlalchemy/engine/reflection.py" >> , line 40, in cache >> ret = fn(self, con, *args, **kw) >> File >> "/usr/local/lib/jython251/Lib/site-packages/sqlalchemy/dialects/oracle/base. >> py", line 764, in get_table_names >> schema = self.denormalize_name(schema or self.default_schema_name) >> AttributeError: 'OracleDialect_zxjdbc' object has no attribute >> 'default_schema_name' >> >> Java 1.6.0 / Jython 2.5.1 / sqlalchemy 0.6.1 >> >> Thanks in advance. >> >> PS: any problems when using postgresql >> > > -- > 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.