Loading transfer_service/db_connector.py +19 −3 Original line number Diff line number Diff line Loading @@ -129,12 +129,12 @@ class DbConnector(object): cursor = conn.cursor(cursor_factory = RealDictCursor) cursor.execute(""" WITH all_nodes AS ( SELECT name, os_name, node_id, parent_path, path, relative_path, owner_id, location_id, null as deleted_on FROM node SELECT name, os_name, node_id, parent_path, path, relative_path, owner_id, location_id, null as deleted_on, null as phy_deleted_on FROM node UNION SELECT name, os_name, node_id, parent_path, path(parent_path, node_id) AS path, path(parent_relative_path, node_id) AS relative_path, owner_id, location_id, deleted_on SELECT name, os_name, node_id, parent_path, path(parent_path, node_id) AS path, path(parent_relative_path, node_id) AS relative_path, owner_id, location_id, deleted_on, phy_deleted_on FROM deleted_node ) SELECT base_path || '/' || owner_id as os_base_path, os_path AS os_rel_path, an.deleted_on SELECT an.node_id, base_path || '/' || owner_id as os_base_path, os_path AS os_rel_path, an.deleted_on, an.phy_deleted_on FROM ( SELECT node_id, '/' || string_agg(name, '/') AS os_path FROM ( Loading Loading @@ -701,6 +701,22 @@ class DbConnector(object): if not conn.closed: conn.rollback() def setPhyDeletedOn(self, nodeId): """Sets the 'phy_deleted_on' flag for a VOSpace deleted node.""" with self.getConnection() as conn: try: cursor = conn.cursor(cursor_factory = RealDictCursor) phyDeletedOn = datetime.datetime.now().isoformat() cursor.execute(""" UPDATE deleted_node SET phy_deleted_on = %s WHERE node_id = %s; """, (phyDeletedOn, nodeId,)) conn.commit() except Exception as e: if not conn.closed: conn.rollback() ##### Storage ##### def insertStorage(self, storageType, basePath, baseUrl, hostname): Loading Loading
transfer_service/db_connector.py +19 −3 Original line number Diff line number Diff line Loading @@ -129,12 +129,12 @@ class DbConnector(object): cursor = conn.cursor(cursor_factory = RealDictCursor) cursor.execute(""" WITH all_nodes AS ( SELECT name, os_name, node_id, parent_path, path, relative_path, owner_id, location_id, null as deleted_on FROM node SELECT name, os_name, node_id, parent_path, path, relative_path, owner_id, location_id, null as deleted_on, null as phy_deleted_on FROM node UNION SELECT name, os_name, node_id, parent_path, path(parent_path, node_id) AS path, path(parent_relative_path, node_id) AS relative_path, owner_id, location_id, deleted_on SELECT name, os_name, node_id, parent_path, path(parent_path, node_id) AS path, path(parent_relative_path, node_id) AS relative_path, owner_id, location_id, deleted_on, phy_deleted_on FROM deleted_node ) SELECT base_path || '/' || owner_id as os_base_path, os_path AS os_rel_path, an.deleted_on SELECT an.node_id, base_path || '/' || owner_id as os_base_path, os_path AS os_rel_path, an.deleted_on, an.phy_deleted_on FROM ( SELECT node_id, '/' || string_agg(name, '/') AS os_path FROM ( Loading Loading @@ -701,6 +701,22 @@ class DbConnector(object): if not conn.closed: conn.rollback() def setPhyDeletedOn(self, nodeId): """Sets the 'phy_deleted_on' flag for a VOSpace deleted node.""" with self.getConnection() as conn: try: cursor = conn.cursor(cursor_factory = RealDictCursor) phyDeletedOn = datetime.datetime.now().isoformat() cursor.execute(""" UPDATE deleted_node SET phy_deleted_on = %s WHERE node_id = %s; """, (phyDeletedOn, nodeId,)) conn.commit() except Exception as e: if not conn.closed: conn.rollback() ##### Storage ##### def insertStorage(self, storageType, basePath, baseUrl, hostname): Loading