Opened 7 years ago

Closed 7 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
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: UI/UX:


While attempting to implement user logins using the authentication framework, I received this error.

Traceback (most recent call last):
  File "", line 11, in ?
  File "/home/swuser/jsafreports/django/django/core/", line 1693, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File "/home/swuser/jsafreports/django/django/core/", line 1592, in execute_from_command_line
    action_mapping[action](int(options.verbosity), options.interactive)
  File "/home/swuser/jsafreports/django/django/core/", line 576, in syncdb
    _emit_post_sync_signal(created_models, verbosity, interactive)
  File "/home/swuser/jsafreports/django/django/core/", line 505, in _emit_post_sync_signal
    verbosity=verbosity, interactive=interactive)
  File "/home/swuser/jsafreports/django/django/dispatch/", line 358, in send
  File "/home/swuser/jsafreports/django/django/dispatch/", line 47, in robustApply
    return receiver(*arguments, **named)
  File "/home/swuser/jsafreports/jsafreports-two/jsaf_reports/../jsaf_reports/jsafreports/", line 115, in install_data
  File "/home/swuser/jsafreports/jsafreports-two/jsaf_reports/../jsaf_reports/jsafreports/", line 137, in create_users
  File "/home/swuser/jsafreports/django/django/db/models/", line 238, in save
    ','.join(placeholders)), db_values)
  File "/home/swuser/jsafreports/django/django/db/backends/oracle/", 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@…> 7 years ago.
Temporary workaround to replace the LazyDate with the DateTime

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Ben Khoo <benk@…>

Temporary workaround to replace the LazyDate with the DateTime

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

comment:2 Changed 7 years ago by bouldersprinters

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.