Loading transfer_service/db_connector.py +9 −1 Original line number Diff line number Diff line Loading @@ -31,9 +31,17 @@ class DbConnector(object): def insertNode(self, node, parentOSPath): if self.conn: out = open("db_connector_log.txt", "a") #print(f"parentOSPath: {parentOSPath}") self.cursor.execute("SELECT get_ltree_path(%s)", (parentOSPath,)) parentLtreePath = self.cursor.fetchone()[0] result = self.cursor.fetchall() for i in result: out.write(f"queryResult: {i}\n") #parentLtreePath = self.cursor.fetchone()[0] parentLtreePath = result[0] out.write(f"parentLtreePath: {parentLtreePath}\n") out.write(f"parentPath: {node.parentPath}\n\n") out.close() #print(f"parentLtreePath: {parentLtreePath}, type: {type(parentLtreePath)}") self.cursor.execute("INSERT INTO Node(parent_path, name, type, owner_id, creator_id, content_md5) VALUES (%s, %s, %s, %s, %s, %s);", (parentLtreePath, node.name, node.type, node.ownerID, node.creatorID, node.contentMD5,)) Loading Loading
transfer_service/db_connector.py +9 −1 Original line number Diff line number Diff line Loading @@ -31,9 +31,17 @@ class DbConnector(object): def insertNode(self, node, parentOSPath): if self.conn: out = open("db_connector_log.txt", "a") #print(f"parentOSPath: {parentOSPath}") self.cursor.execute("SELECT get_ltree_path(%s)", (parentOSPath,)) parentLtreePath = self.cursor.fetchone()[0] result = self.cursor.fetchall() for i in result: out.write(f"queryResult: {i}\n") #parentLtreePath = self.cursor.fetchone()[0] parentLtreePath = result[0] out.write(f"parentLtreePath: {parentLtreePath}\n") out.write(f"parentPath: {node.parentPath}\n\n") out.close() #print(f"parentLtreePath: {parentLtreePath}, type: {type(parentLtreePath)}") self.cursor.execute("INSERT INTO Node(parent_path, name, type, owner_id, creator_id, content_md5) VALUES (%s, %s, %s, %s, %s, %s);", (parentLtreePath, node.name, node.type, node.ownerID, node.creatorID, node.contentMD5,)) Loading