|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
SQLAlchemy problem with dates in SQL Server 2005?I have the following in my SQLAlchemy-based model.py: recurring_tasks = Table('recurring_task', metadata, #Column('rt_est_deploy_date', DateTime), #Column('rt_start_date', DateTime), autoload=True) Regardless of whether the commented lines are commented or not, I get the following error in tg-admin shell: Traceback (most recent call last): File "/usr/local/bin/tg-admin", line 7, in ? sys.exit( File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/ turbogears/command/base.py", line 369, in main command.run() File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/ turbogears/command/base.py", line 169, in run mod = get_model() File "/usr/lib/python2.4/site-packages/TurboGears-1.0.4.4-py2.4.egg/ turbogears/util.py", line 131, in get_model package = __import__(package_name, {}, {}, ["model"]) File "/tools/rtr-alchemy/rtralchemy/model.py", line 20, in ? autoload=True) File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- py2.4.egg/sqlalchemy/schema.py", line 113, in __call__ return type.__call__(self, name, metadata, *args, **kwargs) File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- py2.4.egg/sqlalchemy/schema.py", line 236, in __init__ _bind_or_error(metadata).reflecttable(self, include_columns=include_columns) File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- py2.4.egg/sqlalchemy/engine/base.py", line 1279, in reflecttable self.dialect.reflecttable(conn, table, include_columns) File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- py2.4.egg/sqlalchemy/databases/mssql.py", line 603, in reflecttable coltype = coltype(*args) File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- py2.4.egg/sqlalchemy/databases/mssql.py", line 117, in __init__ super(MSDate, self).__init__(False) TypeError: super(type, obj): obj must be an instance or subtype of type The underlying table is SQL Server 2005 and the data type is smalldatetime. There are no other date-related fields in any of the other tables in my model and when I comment out this table, everything works fine. I would be grateful for any nods in the right direction, as I have only just started using TurboGears and SQLAlchemy Many thanks Jon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@... To unsubscribe from this group, send email to turbogears-unsubscribe@... For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: SQLAlchemy problem with dates in SQL Server 2005?jrpfinch schrieb: > File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- > py2.4.egg/sqlalchemy/databases/mssql.py", line 117, in __init__ > super(MSDate, self).__init__(False) > TypeError: super(type, obj): obj must be an instance or subtype of > type > ... > > I would be grateful for any nods in the right direction, as I have > only just started using TurboGears and SQLAlchemy Looks like a bug in SQLAlchemy to me. It should be "MSSmallDate" instead of "MSDate" in line 117 of sqlalchemy/databases/mssql.py. Can you try if that works and if yes, propose a patch on the SA mailing list or trac? -- Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@... To unsubscribe from this group, send email to turbogears-unsubscribe@... For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: SQLAlchemy problem with dates in SQL Server 2005?On 4 Jul, 16:34, Christoph Zwerschke <c...@...> wrote: > jrpfinch schrieb: > > > File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.5.0beta1- > > py2.4.egg/sqlalchemy/databases/mssql.py", line 117, in __init__ > > super(MSDate, self).__init__(False) > > TypeError: super(type, obj): obj must be an instance or subtype of > > type > > ... > > > I would be grateful for any nods in the right direction, as I have > > only just started using TurboGears and SQLAlchemy > > Looks like a bug in SQLAlchemy to me. It should be "MSSmallDate" instead > of "MSDate" in line 117 of sqlalchemy/databases/mssql.py. Can you try if > that works and if yes, propose a patch on the SA mailing list or trac? > > -- Christoph I've just found the bug reporting feature on SQLAlchemy and yes the bug has already been reported. The fix is just as you describe. Many thanks jon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@... To unsubscribe from this group, send email to turbogears-unsubscribe@... For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |