Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Horcle
On Friday, August 15, 2014 8:28:41 PM UTC-5, Michael Bayer wrote: On Aug 15, 2014, at 5:03 PM, Greg Silverman g...@umn.edu javascript: 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

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Greg Silverman
SELECT default_schema_name FROM sys.database_principals WHERE name = ? AND type = 'S' On Mon, Aug 18, 2014 at 9:47 AM, Horcle g...@umn.edu wrote: On Friday, August 15, 2014 8:28:41 PM UTC-5, Michael Bayer wrote: On Aug 15, 2014, at 5:03 PM, Greg

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Simon King
On Mon, Aug 18, 2014 at 3:47 PM, Horcle g...@umn.edu wrote: On Friday, August 15, 2014 8:28:41 PM UTC-5, Michael Bayer wrote: 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

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Horcle
Indeed! Here is the output: gms$ python test_connect.py 2014-08-18 10:17:28,095 INFO sqlalchemy.engine.base.Engine SELECT user_name() 2014-08-18 10:17:28,095 INFO sqlalchemy.engine.base.Engine () 2014-08-18 10:17:28,097 DEBUG sqlalchemy.engine.base.Engine Col ('',) 2014-08-18 10:17:28,098

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Simon King
I think you are seeing, for each query: 1. The query itself 2. The parameters being passed in to the query 3. The names of the columns being returned 4. The returned rows, if any. So for example, the first thing that happens is: SELECT user_name() with no parameters () returning a

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Horcle
Thanks, this does help. I was wondering why the return results had no values given. Greg-- On Monday, August 18, 2014 11:17:48 AM UTC-5, Simon King wrote: I think you are seeing, for each query: 1. The query itself 2. The parameters being passed in to the query 3. The names of the

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Simon King
It looks like the code that runs the SELECT default_schema_name query has changed since the version you are running: https://bitbucket.org/zzzeek/sqlalchemy/commits/1fb4ad75a38c It might be worth upgrading to the latest release. Simon On Mon, Aug 18, 2014 at 5:22 PM, Horcle g...@umn.edu

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Horcle
Thanks for the heads up. Unfortunately, it did not help. In any case, the issue appears to be that while the last query DOES return a record set when run as straight up SQL on the server, it does not work as desirecd through SQLAlchemy. More digging to be done. Greg-- On Monday, August 18,

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Michael Bayer
try the query as stated along with a pyodbc connection (e.g. conn = pyodbc.connect(...); cursor = conn.cursor(); cursor.execute(the statement); cursor.fetchall()). the way pyodbc is connecting might be changing things. On Aug 18, 2014, at 12:59 PM, Horcle g...@umn.edu wrote: Thanks for

Re: [sqlalchemy] cannot access tables

2014-08-18 Thread Horcle
It ended up being a unicode issue. I had to set this: supports_unicode_binds=False (see Unicde Binds here http://docs.sqlalchemy.org/en/rel_0_9/dialects/mssql.html#module-sqlalchemy.dialects.mssql.pyodbc), in order to get it to work. Annoying, to say the least! python test_connect.py

Re: [sqlalchemy] cannot access tables

2014-08-15 Thread Michael Bayer
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