Mercurial > pylearn
diff pylearn/dbdict/api0.py @ 629:4e7781972999
merge
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Mon, 19 Jan 2009 18:35:43 -0500 |
parents | 739720896d61 123ca7751a80 |
children | e242c12eb30d |
line wrap: on
line diff
--- a/pylearn/dbdict/api0.py Mon Jan 19 18:34:13 2009 -0500 +++ b/pylearn/dbdict/api0.py Mon Jan 19 18:35:43 2009 -0500 @@ -3,6 +3,7 @@ from sqlalchemy.orm import sessionmaker from sqlalchemy import Table, Column, MetaData, ForeignKey from sqlalchemy import Integer, String, Float, Boolean, DateTime, Text, Binary +from sqlalchemy.databases import postgres from sqlalchemy.orm import mapper, relation, backref, eagerload from sqlalchemy.sql import operators, select from sql_commands import crazy_sql_command @@ -69,7 +70,7 @@ h_self._link_table = link_table #TODO: replace this crude algorithm (ticket #17) - if ['id', 'create', 'write', 'read', 'status', 'priority'] != [c.name for c in dict_table.c]: + if ['id', 'create', 'write', 'read', 'status', 'priority','hash'] != [c.name for c in dict_table.c]: raise ValueError(h_self.e_bad_table, dict_table) if ['id', 'name', 'ntype', 'fval', 'sval', 'bval'] != [c.name for c in pair_table.c]: raise ValueError(h_self.e_bad_table, pair_table) @@ -276,6 +277,7 @@ # helper routine by update() and __setitem__ def _set_in_session(d_self, key, val, session): """Modify an existing key or create a key to hold val""" + #FIRST SOME MIRRORING HACKS if key == 'dbdict.status': ival = int(val) @@ -283,6 +285,9 @@ if key == 'dbdict.sql.priority': fval = float(val) d_self.priority = fval + if key == 'dbdict.hash': + ival = int(val) + d_self.hash = ival if key in d_self._forbidden_keys: raise KeyError(key) @@ -533,7 +538,8 @@ Column('write', DateTime), Column('read', DateTime), Column('status', Integer), - Column('priority', Float(53)) + Column('priority', Float(53)), + Column('hash', postgres.PGBigInteger) ) t_keyval = Table(table_prefix+keyval_suffix, metadata,