Hello.

> I dont have easy access to pymssql here so can you fully define what "fails" 
> means ?  stack trace ?

I don't have access to my development environment during the weekend, so I 
cannot provide you with a stacktrace, but I try to better describe the issue:

    def _get_server_version_info(self, connection)
        vers = connection.scalar("select @@version")
        m = re.match(r"Microsoft SQL Server.*? - (\d+).(\d+).(\d+).(\d+)", vers)
        ...

The above code snippet is from the file pymssql (around line 80). The variable 
vers is set to None and because of that the following regex fails with error 
"Expected string or buffer". The None is returned by the call to scalar(). The 
code snippet (from memory, I don't remember its exact location and form):

    iter(resultproxy).next()

is called to get a next (first) result from the result proxy and it simply 
returns None as if there were no rows.

Ladislav Lenart


Od: "Michael Bayer" <mike...@zzzcomputing.com>
> On Oct 5, 2012, at 9:40 AM, Ladislav Lenart wrote:
> 
> > Hello.
> > 
> > I try to access a Microsoft SQL database from Linux (Debian testing):
> > 
> >    from sqlalchemy.ext.sqlsoup import SqlSoup
> > 
> >    conn_string = 'mssql+pymssql://user:pass@freetds_name'
> >    db = SqlSoup(conn_string)
> >    v = db.some_table.first()
> >    print v
> > 
> > freetds_name is the section name from /etc/freetds/freetds.conf
> > 
> >    [freetds_name]
> >    host = ...
> >    port = 1433
> >    tds version = 7.1
> >    asa database = DB
> > 
> > The above script fails
> 
> 
> I dont have easy access to pymssql here so can you fully define what "fails" 
> means ?  stack trace ?
> 
> 
> 
> 
> > in pymssql on line 83, because line 81 sets vers to None:
> > 
> >    def _get_server_version_info(self, connection):
> >        vers = connection.scalar("select @@version")
> >        m = re.match(
> >            r"Microsoft SQL Server.*? - (\d+).(\d+).(\d+).(\d+)", vers)
> >        if m:
> >            return tuple(int(x) for x in m.group(1, 2, 3, 4))
> >        else:
> >            return None
> > 
> > But the following works in tsql:
> > 
> >    1> select @@version
> >    2> go
> > 
> >    Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (X64)
> >             Apr 22 2011 19:23:43
> >             Copyright (c) Microsoft Corporation
> >             Workgroup Edition (64-bit) on Windows NT 6.1 <X64>
> >             (Build 7601: Service Pack 1) (Hypervisor)
> > 
> >    (1 row affected)
> > 
> > 
> > Any idea what is wrong?
> > 
> > 
> > Thank you,
> > 
> > Ladislav Lenart
> > 
> > -- 
> > 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.
> 
> 

-- 
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