This project is archived and is in readonly mode.
Equality does not work for psycopg2._psycopg.datetime objects.
-
Daniele Varrazzo
- State changed from new to invalid
From the documentation, which is copied from the dbapi
psycopg2.DateFromTicks(ticks) This function constructs an object holding a date value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).The object returned is a wrapper for a date object:
In [8]: x = psycopg2.DateFromTicks(1351283379.10619) In [9]: x Out[9]: <psycopg2._psycopg.datetime object at 0x94ab8cc> In [10]: x.adapted Out[10]: datetime.date(2012, 10, 26)psycopg returns adapters in several places, which are only used to pass data to the database. We don't give any of these adapter the semantics of the wrapped object (comparability, ordering etc). Please extract the object you need to work with from the wrapper and use it as you need. I will add to the documentation the fact that it can be reached through the
adaptedattribute.