google-code-export / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

date column returns day value that is out of range #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have the trunk building against FreeTDS shipped with Ubuntu 10.04 
(0.82-1build6).  I have also done a special build to use the configure line:

 --enable-msdblib

with the same results.  I did some debugging and the number being returned for 
di.day is 96.

Debug output follows:

2011-04-07 01:01:13,831 INFO sqlalchemy.engine.base.Engine.0x...bf10 BEGIN 
(implicit)
2011-04-07 01:01:13,831 INFO sqlalchemy.engine.base.Engine.0x...bf10 SELECT 
auth_applications.id AS auth_applications_id, auth_applications.createdts AS 
auth_applications_createdts, auth_applications.updatedts AS 
auth_applications_updatedts, auth_applications.name AS auth_applications_name 
FROM auth_applications 
WHERE auth_applications.id = %(param_1)s
2011-04-07 01:01:13,831 INFO sqlalchemy.engine.base.Engine.0x...bf10 
{'param_1': 1}
+++ _mssql.MSSQLConnection.execute_query()
+++ _mssql.MSSQLConnection.format_and_run_query()
+++ _mssql.MSSQLConnection.cancel()
+++ _mssql.assert_connected()
+++ _mssql.MSSQLConnection.clear_metadata()
+++ _mssql.MSSQLConnection.format_sql_command()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.MSSQLConnection.clear_metadata()
+++ _mssql.MSSQLConnection.get_header()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.MSSQLConnection.get_header()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.assert_connected()
+++ _mssql.assert_connected()
+++ _mssql.MSSQLConnection.fetch_next_row_dict()
+++ _mssql.MSSQLConnection.fetch_next_row()
+++ _mssql.MSSQLConnection.get_result()
+++ _mssql.MSSQLConnection.get_row()
Processing row 52, column 1,Got data=313e620, coltype=56, len=4
+++ _mssql.MSSQLConnection.convert_db_value()
Processing row 52, column 2,Got data=313e628, coltype=61, len=8
+++ _mssql.MSSQLConnection.convert_db_value()
Traceback (most recent call last):
  File "/home/rsyring/dev/customers/pai/paiauth-venv/bin/nosetests", line 8, in <module>
    load_entry_point('nose==1.0.0', 'console_scripts', 'nosetests')()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/core.py", line 118, in __init__
    **extra_args)
  File "/usr/lib/python2.6/unittest.py", line 816, in __init__
    self.parseArgs(argv)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/core.py", line 135, in parseArgs
    self.config.configure(argv, doc=self.usage())
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/config.py", line 330, in configure
    self.plugins.begin()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 94, in __call__
    return self.call(*arg, **kw)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/nose/plugins/manager.py", line 162, in simple
    result = meth(*arg, **kw)
  File "/home/rsyring/dev/blaze/web-venv/src/default/blazeweb/nose_plugin.py", line 89, in begin
    signal('blazeweb.pre_test_init').send()
  File "build/bdist.linux-x86_64/egg/blinker/base.py", line 220, in send
  File "/home/rsyring/dev/blaze/sabwc-src/default/sqlalchemybwc/events.py", line 7, in setup_db_structure
    run_tasks(settings.components.sqlalchemy.pre_test_init_tasks)
  File "/home/rsyring/dev/blaze/web-venv/src/default/blazeweb/tasks.py", line 99, in run_tasks
    callable_retval = call_tuple[2]()
  File "<string>", line 2, in action_30_base_data
  File "/home/rsyring/dev/blaze/web-venv/src/default/blazeweb/tasks.py", line 9, in _attributes
    return f(*args, **kwargs)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/src/paiauth-dist/paicore/tasks/init_db.py", line 14, in action_30_base_data
    paicsa_app = Application.get_or_create('paicsa')
  File "/home/rsyring/dev/customers/pai/paiauth-venv/src/paiauth-dist/paicore/components/auth/model/orm.py", line 51, in get_or_create
    settings.app_ids[abbr] = app.id
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/attributes.py", line 168, in __get__
    instance_dict(instance))
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/attributes.py", line 388, in get
    value = callable_(passive=passive)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/state.py", line 287, in __call__
    self.manager.deferred_scalar_loader(self, toload)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 2492, in _load_scalar_attributes
    only_load_props=attribute_names)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1958, in _get
    return q.one()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1646, in one
    ret = list(self)
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1791, in instances
    fetch = cursor.fetchall()
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 2498, in fetchall
    l = self.process_rows(self._fetchall_impl())
  File "/home/rsyring/dev/customers/pai/paiauth-venv/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 2465, in _fetchall_impl
    return self.cursor.fetchall()
  File "pymssql.pyx", line 436, in pymssql.Cursor.fetchall (pymssql.c:5453)
    type(r) == int]) for row in self._source._conn]
  File "_mssql.pyx", line 331, in _mssql.MSSQLRowIterator.__next__ (_mssql.c:2979)
    return self.conn.fetch_next_row_dict(1)
  File "_mssql.pyx", line 891, in _mssql.MSSQLConnection.fetch_next_row_dict (_mssql.c:8276)
    row = self.fetch_next_row(throw)
  File "_mssql.pyx", line 884, in _mssql.MSSQLConnection.fetch_next_row (_mssql.c:8203)
    return self.get_row(rtc)
  File "_mssql.pyx", line 1034, in _mssql.MSSQLConnection.get_row (_mssql.c:9441)
    record += (self.convert_db_value(data, col_type, len),)
  File "_mssql.pyx", line 619, in _mssql.MSSQLConnection.convert_db_value (_mssql.c:5502)
    return datetime.datetime(di.year, di.month, di.day,
ValueError: day is out of range for month

Original issue reported on code.google.com by rsyr...@gmail.com on 7 Apr 2011 at 5:04

GoogleCodeExporter commented 9 years ago
I am no longer seeing this behavior with FreeTDS snapshot.  Also, almost all 
SQLAlchemy tests are passing, so I think this is resolved.

Original comment by rsyr...@gmail.com on 7 May 2011 at 5:08