From ffcd60ac6eadd5a7fe30c2654077983e42b488a1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 26 Jan 2006 00:25:36 +0000 Subject: [PATCH] ai more reasonable hash_key that works across serializations might want to get the DB password out of it tho.... --- lib/sqlalchemy/engine.py | 5 +++++ lib/sqlalchemy/schema.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lib/sqlalchemy/engine.py b/lib/sqlalchemy/engine.py index 72c8c8a94d..d384ba2b39 100644 --- a/lib/sqlalchemy/engine.py +++ b/lib/sqlalchemy/engine.py @@ -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 + + diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index e2059f29f5..c55d9034a0 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -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 -- 2.47.2