]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
ai more reasonable hash_key that works across serializations
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 26 Jan 2006 00:25:36 +0000 (00:25 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 26 Jan 2006 00:25:36 +0000 (00:25 +0000)
might want to get the DB password out of it tho....

lib/sqlalchemy/engine.py
lib/sqlalchemy/schema.py

index 72c8c8a94d45512e3f5e2acbe028bba3b3dccbf5..d384ba2b3953828188329205d232e8914b271854 100644 (file)
@@ -184,6 +184,9 @@ class SQLEngine(schema.SchemaEngine):
         else:
             self.logger = logger
 
+    def hash_key(self):
+        return "%s(%s)" % (self.__class__.__name__, repr(self.connect_args()))
+        
     def dispose(self):
         """disposes of the underlying pool manager for this SQLEngine."""
         (cargs, cparams) = self.connect_args()
@@ -698,3 +701,5 @@ class RowProxy:
         except:
             raise AttributeError
 
+
+
index e2059f29f5fc732b7815e7b44dbaf4bc8f386285..c55d9034a030c7e068ba6ccf0994952f1bbb1ec6 100644 (file)
@@ -154,6 +154,12 @@ class Table(SchemaItem):
         ["%s=%s" % (k, repr(getattr(self, k))) for k in ['schema']]
        , ',\n')
     
+    def hash_key(self):
+        return "Table(%s)" % string.join(
+        [repr(self.name)] + [self.engine.hash_key()] +
+        ["%s=%s" % (k, repr(getattr(self, k))) for k in ['schema']], ','
+        )
+        
     def reload_values(self, *args):
         """clears out the columns and other properties of this Table, and reloads them from the 
         given argument list.  This is used with the "redefine" keyword argument sent to the