On Aug 15, 2014, at 5:03 PM, Greg Silverman <g...@umn.edu> wrote:

> 
> Then, I thought, what if this is an SQLAlchemy issue. Looks to be. I ran the 
> following script as a test:
> 
> import pyodbc
> import sqlalchemy
> from sqlalchemy.engine import reflection
> from sqlalchemy.engine.reflection import Inspector
> 
> def connect():
>     return pyodbc.connect(
>               'DRIVER={FreeTDS};SERVER=<ip_address>;'
>               'DATABASE=<db_name>;UID=test;PWD=test;port=1433;'
>               'TDS_Version=9.1;')
> engine = sqlalchemy.create_engine('mssql://', creator=connect)
> conn = engine.connect()
> print conn
> 
> for row in engine.execute('select 6 * 7 as [Result];'):
>     print row.Result
> 
> insp = reflection.Inspector.from_engine(engine)
> table_name = 'irb_desc'
> table_names = insp.get_table_names()
> if table_name not in table_names:
>     print 'A'
> 
> Again, I am connecting fine with the database create.engine method (that is 
> '42' is printing as expected), but when I run the inspector.get_table_names 
> method with the given conditional it is printing the 'A' (I have tried other 
> table names in the same database to which I added 'irbd_balance,' all with 
> the same result.


what is the SQL output if you set echo='debug';   then, take the SQL you see 
and take a look at what it's SELECTing so you can see what might be wrong.  
Probably some schema name setting or something like that.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to