Subject fdb: Error converting datetime data
Author Maximiliano Robaina
Hi,

I'm working on fdb adapting of django-firebird (former used kinterbasdb).
Running some test (django tests suite, I get an error when django try to insert some fixtures (data to test) in a table.

The traceback is (relevant snippet)

File "/usr/local/lib/python2.7/dist-packages/firebird/base.py", line 146, in execute
    return self.cursor.execute(query, params)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 2234, in execute
    self._ps._execute(parameters)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 2071, in _execute
    self.__Tuple2XSQLDA(self.in_sqlda, parameters)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 1924, in __Tuple2XSQLDA
    self._convert_timestamp(value))), buf_pointer)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 1621, in _convert_timestamp
    return self._convert_date(v.date()) + self._convert_time(v.time())
AttributeError: Problem installing fixture '/usr/local/lib/python2.7/dist-packages/django/contrib/auth/fixtures/context-processors-users.xml': 'unicode' object has no attribute 'date'


And the problematic value is:

2007-05-30 13:20:10


u'2007-05-30 13:20:10'  <-- repr of value


In fbcore.py:

def _convert_timestamp(self, v):   # Convert datetime.datetime
                                        # to BLR format timestamp
        print v, repr(v)
        return self._convert_date(v.date()) + self._convert_time(v.time())




Is necessary to do some data translation like kinterbasdb ?

How can I resolve it?

Thanks in advance.


--
Maxi


b: http://maxirobaina.tumblr.com
t: http://twitter.com/maxirobaina