include_columns is a list of strings indicating the names of those columns 
which you'd like reflected.  If you want to reflect all columns from the table, 
leave that argument out.

On Feb 8, 2011, at 4:36 PM, Paul Rigor wrote:

> Hello,
> 
> I have a table with the following schema:
> 
> +-------------+---------------+------+-----+---------+----------------+
> | Field       | Type          | Null | Key | Default | Extra          |
> +-------------+---------------+------+-----+---------+----------------+
> | acc         | varchar(1024) | YES  |     | NULL    |                | 
> | is_obsolete | int(11)       | YES  |     | NULL    |                | 
> | is_root     | int(11)       | YES  |     | NULL    |                | 
> | term_type   | varchar(1024) | YES  |     | NULL    |                | 
> | id          | int(11)       | YES  |     | NULL    |                | 
> | cid         | int(11)       | NO   | PRI | NULL    | auto_increment | 
> | name        | varchar(1024) | YES  |     | NULL    |                | 
> +-------------+---------------+------+-----+---------+----------------+
> 
> 
> When attempting to run the following code to obtain column information 
> programmatically...
> 
> from sqlalchemy import create_engine, MetaData, Table
> from sqlalchemy.engine import reflection
> dburi = "mysql://..."
> engine =  create_engine(dburi)
> meta = MetaData(dburi)
> user_table = Table('term', meta,useexisting=True)
> engine.reflecttable(user_table,include_columns=True) # More verbose error 
> trace
> insp = reflection.Inspector.from_engine(engine)
> insp.reflecttable(user_table, include_columns=True) 
> 
> 
> I get the following problem:
> python2.6/site-packages/SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/engine/reflection.pyc
>  in reflecttable(self, table, include_columns)
>     383             found_table = True
>     384             name = col_d['name']
> --> 385             if include_columns and name not in include_columns:
>     386                 continue
>     387
> 
> TypeError: argument of type 'bool' is not iterable
> 
> Is there a better way of obtaining table schemas?
> 
> Thanks,
> Paul
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@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 sqlalchemy@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.

Reply via email to