[boulder-oracle] LazyDate objects are not being handled by the Oracle backend
|Reported by:||Ben Khoo <benk@…>||Owned by:||adrian|
|Component:||Database layer (models, ORM)||Version:||other branch|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
While attempting to implement user logins using the authentication framework, I received this error.
Traceback (most recent call last): File "manage.py", line 11, in ? execute_manager(settings) File "/home/swuser/jsafreports/django/django/core/management.py", line 1693, in execute_manager execute_from_command_line(action_mapping, argv) File "/home/swuser/jsafreports/django/django/core/management.py", line 1592, in execute_from_command_line action_mapping[action](int(options.verbosity), options.interactive) File "/home/swuser/jsafreports/django/django/core/management.py", line 576, in syncdb _emit_post_sync_signal(created_models, verbosity, interactive) File "/home/swuser/jsafreports/django/django/core/management.py", line 505, in _emit_post_sync_signal verbosity=verbosity, interactive=interactive) File "/home/swuser/jsafreports/django/django/dispatch/dispatcher.py", line 358, in send sender=sender, File "/home/swuser/jsafreports/django/django/dispatch/robustapply.py", line 47, in robustApply return receiver(*arguments, **named) File "/home/swuser/jsafreports/jsafreports-two/jsaf_reports/../jsaf_reports/jsafreports/management.py", line 115, in install_data create_users() File "/home/swuser/jsafreports/jsafreports-two/jsaf_reports/../jsaf_reports/jsafreports/management.py", line 137, in create_users u.save() File "/home/swuser/jsafreports/django/django/db/models/base.py", line 238, in save ','.join(placeholders)), db_values) File "/home/swuser/jsafreports/django/django/db/backends/oracle/base.py", line 103, in execute return Database.Cursor.execute(self, query, params) cx_Oracle.NotSupportedError: Variable_TypeByValue(): unhandled data type LazyDate
The error stems from cx_Oracle being unable to convert a LazyDate object to an appropriate representation for the Oracle Timestamp datatype.
I have attached a patch that works around this problem by replacing the LazyDate object with a DateTime object before the query is executed. I don't believe this is suitable for a final fix because it violates the LazyDate object by directly invoking the __get_value__() function.
I am using the boulder-oracle-sprint branch.
Change History (3)
Changed 7 years ago by Ben Khoo <benk@…>
comment:1 Changed 7 years ago by Simon G. <dev@…>
- Component changed from Uncategorized to Database wrapper
- Needs documentation unset
- Needs tests unset
- Owner changed from jacob to adrian
- Patch needs improvement set
- Summary changed from LazyDate objects are not being handled by the Oracle backend to [boulder-oracle] LazyDate objects are not being handled by the Oracle backend
- Triage Stage changed from Unreviewed to Accepted