Opened 18 years ago

Closed 18 years ago

#3721 closed (fixed)

[boulder-oracle] LazyDate objects are not being handled by the Oracle backend

Reported by: Ben Khoo <benk@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: other branch
Severity: Keywords: Oracle LazyDate
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

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.

Attachments (1)

oracle_lazydate.patch (879 bytes ) - added by Ben Khoo <benk@…> 18 years ago.
Temporary workaround to replace the LazyDate with the DateTime

Download all attachments as: .zip

Change History (3)

by Ben Khoo <benk@…>, 18 years ago

Attachment: oracle_lazydate.patch added

Temporary workaround to replace the LazyDate with the DateTime

comment:1 by Simon G. <dev@…>, 18 years ago

Component: UncategorizedDatabase wrapper
Owner: changed from Jacob to Adrian Holovaty
Patch needs improvement: set
Summary: LazyDate objects are not being handled by the Oracle backend[boulder-oracle] LazyDate objects are not being handled by the Oracle backend
Triage Stage: UnreviewedAccepted

comment:2 by Matt Boersma, 18 years ago

Resolution: fixed
Status: newclosed

(In [4727]) boulder-oracle-sprint: Fixed #3721 with Ben Khoo's patch for working around
LazyDate in Oracle.

Note: See TracTickets for help on using tickets.
Back to Top