Table autoloading fails in mssql
Issue #1289
resolved
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)
-
Account Deleted -
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
-
Account Deleted (original author: ram) Please try 0caf97126394f059d94bffb5c2fdf49c4680cba1, it contains an updated method of table reflection that should fix this issue.
-
Account Deleted Works beautifully. thx !
-
repo owner - removed milestone
Removing milestone: 0.5.2 (automated comment)
- Log in to comment
(original author: ram) Please post the table structure causing this problem. Table structure in MSSQL can be retrieved using:
exec sp_columns <tablename>