When creating a Table object with the autoload parameter set to True, DateTime fields in SQL Server 2000 apepar to cause fatal errors in SQLAlchemy. In the reflecttable method in mssql.py, it pulls a numericprec and numericscale value for the DateTime column. It then stuffs these two values into the args variable, and attempts to pass them to the proper TypeEngine type.
The problem is that it resolves the type to MSDateTime, which is a child of DateTime. The constructor for DateTime only takes a timezone agrument (and self of course), so when the constructor is called at line 1168: coltype = coltype(*args, **kwargs) The following exception is thrown: TypeError: __init__() takes at most 2 arguments (3 given) You can recreate the bug by doing the following: 1) Run the following script on your SQL Server 2000 server. CREATE DATABASE SADateTimeBug GO USE SADateTimeBug GO CREATE TABLE [dbo].[testtable] ( [testid] [int] IDENTITY (1, 1) NOT NULL , [testDate] [datetime] NOT NULL ) ON [PRIMARY] GO 2) Run the following python code: from sqlalchemy import Table, MetaData, create_engine from sqlalchemy.orm import sessionmaker appTrackEngine = create_engine('mssql://./SATest', module_name='pyodbc') appTrackMetaData = MetaData() appTrackMetaData.bind = appTrackEngine AppTrackSession = sessionmaker(bind=appTrackEngine) table_applications = Table('testtable', appTrackMetaData, autoload=True) Is this a real bug or am I doing something wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---