This project is archived and is in readonly mode.
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
-
Daniele Varrazzo October 27th, 2012 @ 12:43 PM
- 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
adapted
attribute.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
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.