Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-05 Thread Mike Bayer
OK thanks for looking into this and I'm glad we found the issue, mostly thanks to your prompt and accurate replies so thanks! On Wed, Jul 5, 2017 at 9:46 AM, Paul Morel wrote: > It is possible that in the end that was the case, however, the reason I even >

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-05 Thread Paul Morel
It is possible that in the end that was the case, however, the reason I even attempted the pip uninstall/install originally was because of the error I was getting. I found some SO posts that recommended rolling back to an earlier version of SQLAlchemy. Rolling back had no impact. I then

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-05 Thread Mike Bayer
On Jul 5, 2017 12:59 AM, "Paul Morel" wrote: It appears that the Anaconda installer placed the .pyd files there. I discovered that pip uninstall doesn't remove those files like I had assumed. Therefore, when I pip uninstalled/installed the original .pyd files

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
It appears that the Anaconda installer placed the .pyd files there. I discovered that pip uninstall doesn't remove those files like I had assumed. Therefore, when I pip uninstalled/installed the original .pyd files were still there. It looks like deleting the .pyd files and pip installing

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Jonathan Vanasco
Is there a chance you updated the Python binary as part of your process? Weird stuff like this often happens if you forget to trash the site-packages or virtualenv after a python version upgrade (even on a micro version upgrade) -- SQLAlchemy - The Python SQL Toolkit and Object Relational

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Mike Bayer
Ok how did the pyd file get there in the first place, was that pre-built as part of anaconda or did it compile on your local machine? This is kind of a serious issue that a broken shared library got created On Jul 4, 2017 7:55 PM, "Paul Morel" wrote: BAM! That

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
BAM! That was it. There must be some type of incompatibility between the c extensions and the Windows 2008 Server configuration. I pip uninstalled/installed and found the c extensions where rebuilt. After removing *cresultproxy.pyd* from the sqlalchemy site-packages directory the queries

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Mike Bayer
it's the select schema_name() query that's failing and that cursor.description is fine. did you build the SQLAlchemy C extensions on windows? or does your anaconda build somehow deliver sqlalchemy/cresultproxy.dll to your installation ?my last theory here is that you have C extensions set

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
Sorry, I gave you the cursor.description of the schema_name() query. This is the output for the cursor.description for the SELECT * FROM EPO_MODELS query: *pymssql Cursor Description is:* > ((u'ID', 3, None, None, None, None, None), (u'MODELTYPE', 3, None, None, > None, N > one, None),

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
> > Testing *pymssql* Directly > > Complete > Testing Get Schema Name with pymssql > (u'dbo',) > > *Cursor Description is:((u'', 1, None, None, None, None, None),)* > Complete > Testing *pyodbc* Directly > > Complete > Testing Get Schema Name

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Mike Bayer
in your direct examples can you show me the output of "cursor.description" as well once you execute the query? On Tue, Jul 4, 2017 at 11:17 AM, Paul Morel wrote: > I ran that select statement under both the pyodbc and pymssql direct > connections and it appears to

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
I ran that select statement under both the pyodbc and pymssql direct connections and it appears to have returned a legitimate row of data. This is the excerpt from the test output: Testing pymssql Directly > > Complete > Testing Get Schema Name with pymssql > (u'dbo',) >

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Mike Bayer
It's never a good idea to just blanket ignore all exceptions. There are a few cases where we except for dbapi.Error in order to catch unsupported calls such as looking for sys.dm_exec_sessions. However here, SQL Server is not complaining at all. A result is returned. The result has a row.

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Mike Bayer
can you run this query please? SELECT schema_name() the issue is, that query is returning a result, there is a row, but it no columns, which is nonsensical. Did you try running with the mssql+pymssql:// driver? Looks like a pyodbc bug so far but need more info. On Tue, Jul 4, 2017 at 9:59

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
I don't know the downstream implications of doing this but would it make sense to wrap lines 1773-1777 in a try/except with the except block returning self.schema_name. Like this: def _get_default_schema_name(self, connection): if self.server_version_info < MS_2005_VERSION: return

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Simon King
The key part of the stack trace is: File "c:\Program Files\Anaconda2\lib\site-packages\sqlalchemy\dialects\mssql\base.py", line 1773, in _get_default_schema_name default_schema_name = connection.scalar(query) ...which is in this function:

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-04 Thread Paul Morel
Mike, Sorry for the lack of information. Please find the rest of what you wanted below. *Full Stack Trace:* Running Direct SQL Query > Traceback (most recent call last): > File "test.py", line 45, in result = con.execute('SELECT * FROM > EPO_MODELS') > File "c:\Program >

Re: [sqlalchemy] SQLAlchemy won't connect correctly but pyodbc and pymssql will

2017-07-03 Thread Mike Bayer
Can you send complete stack trace please? That's the main thing that will show which query this is occurring on (there are several upon connect). Also full detail on SQL server version, odbc driver, client operating system. On Jul 3, 2017 7:26 PM, "Paul Morel"