From: Sofia Papagiannaki Date: Thu, 8 Sep 2011 12:44:04 +0000 (+0300) Subject: AlchemyBackend do db insert or replace in policy_set and attribute_copy X-Git-Tag: pithos/v0.7.8~89^2~4 X-Git-Url: https://code.grnet.gr/git/pithos/commitdiff_plain/dc9e6086c356857cfb180e01bebad7e5ea119e35 AlchemyBackend do db insert or replace in policy_set and attribute_copy --- diff --git a/pithos/backends/lib_alchemy/node.py b/pithos/backends/lib_alchemy/node.py index 6e7c887..7bd5210 100644 --- a/pithos/backends/lib_alchemy/node.py +++ b/pithos/backends/lib_alchemy/node.py @@ -654,6 +654,7 @@ class Node(DBWorker): attributes = rp.fetchall() rp.close() for dest, k, v in attributes: + #insert or replace s = self.attributes.update().where(and_( self.attributes.c.serial == dest, self.attributes.c.key == k)) diff --git a/pithos/backends/lib_alchemy/policy.py b/pithos/backends/lib_alchemy/policy.py index 203bc7d..66ff9fa 100644 --- a/pithos/backends/lib_alchemy/policy.py +++ b/pithos/backends/lib_alchemy/policy.py @@ -52,6 +52,7 @@ class Policy(DBWorker): metadata.bind = self.engine def policy_set(self, path, policy): + #insert or replace for k, v in policy.iteritems(): s = self.policies.update().where(and_(self.policies.c.path == path, self.policies.c.key == k))