Equality does not work for psycopg2._psycopg.datetime objects.
Reported by Kevin Warrick | October 27th, 2012 @ 12:35 AM
>>> ts = 1351283379.10619 >>> psycopg2.DateFromTicks(ts) == psycopg2.DateFromTicks(ts) False
Comments and changes to this ticket
- State changed from new to invalid
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 : x = psycopg2.DateFromTicks(1351283379.10619) In : x Out: <psycopg2._psycopg.datetime object at 0x94ab8cc> In : x.adapted Out: 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
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.