Table autoloading fails in mssql

Issue #1289 resolved
Former user created an issue

When trying to autoload a table on an mssql DB in SQLAlchemy 0.5.1, I get following error:

sqlalchemy/databases/mssql.py in reflecttable(self, connection, table, include_columns)

   1155                 elif coltype in (MSNVarchar,) and charlen == -1:
   1156                     args[0](0) = None
-> 1157                 coltype = coltype(*args, **kwargs)
   1158             colargs = []
   1159             if default is not None:

<type 'exceptions.TypeError'>: __init__() takes at most 2 arguments (3 given)

The variables on the contexts are as follows,

args = {
  self = <sqlalchemy.databases.mssql.MSSQLDialect_pymssql object at 0x7f2333c35850>,
  connection = <sqlalchemy.engine.base.Connection object at 0x7f233282cb90>,
  table = aspnet_Membership,
  include_columns = None,
}

kwargs = {}

Attached the example. ( need to fix connection string for your testing DB )

Commenting that line(1157) out seems to fix the issue, but I'm not sure -- I did not trace deeply into the source codes.

Comments (5)

  1. Former user Account Deleted

    (original author: ram) Please post the table structure causing this problem. Table structure in MSSQL can be retrieved using:

    exec sp_columns <tablename>

  2. Former user Account Deleted

    Attached the the table structure. (It's not 'aspnet_Membership' in the original report, but the same problem happens for this one, too.)

    Also, I'm using following options in the freetds.conf.

        tds version = 8.0
        port = 1433
        client charset = UTF-8
    
  3. Log in to comment