From: <no...@so...> - 2002-11-07 04:21:16
|
Bugs item #634542, was opened at 2002-11-06 12:12 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=634542&group_id=16528 Category: PgResult Group: None Status: Open Resolution: None >Priority: 7 Submitted By: Petter Reinholdtsen (pere) >Assigned to: Billy G. Allie (ballie01) Summary: SQL integer is not hashable Initial Comment: I'm unable to use a numeric value as the key in a dictioary. This is the error message: Traceback (most recent call last): File "Cerebrum/tests/SQLDriverTestCase.py", line 30, in testSQLIntHashable hash[value] = 1 TypeError: unhashable instance This is a fragment of the test code that fails: self.db.execute("CREATE TABLE test_db_dict (value NUMERIC(6,0))") self.db.execute("INSERT INTO test_db_dict (value) VALUES (1)") value = self.db.query_1("SELECT max(value) FROM test_db_dict") hash = {} hash[value] = 1 ---------------------------------------------------------------------- >Comment By: Billy G. Allie (ballie01) Date: 2002-11-06 23:21 Message: Logged In: YES user_id=8500 I'll take this one Gerhard ---------------------------------------------------------------------- Comment By: Gerhard Häring (ghaering) Date: 2002-11-06 22:36 Message: Logged In: YES user_id=163326 Ah. You are getting a PgNumeric, which currently isn't hashable. Billy, do you want to handle this? Otherwise I'll give it a try eventually. Or alternatively, Petter, a patch for this would be most welcome :-) As a temporary workaround, you can perhaps convert the PgNumeric to a float or a string. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=116528&aid=634542&group_id=16528 |