This is just a helpful tip should anyone else run into this problem. When
using MS SQL 2012 (may also happen with 2010 and 2008) and the DAL's
executesql() feature, if your query includes data type columns they'll have
a tendency to be pulled in by pyodbc as unicode strings rather than dates.
To resolve this, when you initialize your database connection just add an
extra driver_arg to specify "{SQL Server Native Client 10.0}"
db = DAL('mssql://username:password@server/database', lazy_tables=True,
driver_args=dict(Driver = '{SQL Server Native Client 10.0}'))
See also
https://stackoverflow.com/questions/7172540/pyodbc-returns-sql-server-date-fields-as-strings
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.