Re: [SQLObject] possible bug in pymssql make_conn_str
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2013-08-16 01:22:25
|
On Thu, Aug 15, 2013 at 05:57:37PM -0700, Robert Ayrapetyan <rob...@gm...> wrote: > There is a code in sqlobject/mssql/mssqlconnection.py: > > else: # pymssql > self.dbconnection = sqlmodule.connect > sqlmodule.Binary = lambda st: str(st) > # don't know whether pymssql uses unicode > self.usingUnicodeStrings = False > self.make_conn_str = lambda keys: \ > ["", keys.user, keys.password, keys.host, keys.db] > > However, pymssql.connect declaration is following: > > def connect(server='.', user='', password='', database='', timeout=0, > login_timeout=60, charset=None, as_dict=False, > host='', appname=None, port='1433') > > So seems make_conn_str produces wrong set of params which throws: > > pymssql.InterfaceError: Connection to the database failed for an unknown > reason. > > (because actual host value is empty). > > I've updated it like that: > > self.make_conn_str = lambda keys: \ > [".", keys.user, keys.password, keys.db, 0, 60, > None, False, keys.host, None, keys.port] > > and things started to work. Thank you. I don't use MSSQL so I cannot test it. I will apply and commit your code later. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |