From 0540c44eab8d323ae6328c20d66f755dee0d8680 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Thu, 12 Sep 2024 17:32:35 +0330 Subject: [PATCH 1/2] fix: deletion of graph data is now platform agnostic! previouly we forgot to update the data deletion to support newer platform agnostic structure. --- .../DB_operations/mongo_neo4j_ops.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tc_analyzer_lib/DB_operations/mongo_neo4j_ops.py b/tc_analyzer_lib/DB_operations/mongo_neo4j_ops.py index 02a0598..a169070 100644 --- a/tc_analyzer_lib/DB_operations/mongo_neo4j_ops.py +++ b/tc_analyzer_lib/DB_operations/mongo_neo4j_ops.py @@ -90,12 +90,17 @@ def store_analytics_data( platform_id=platform_id, queries_list=queries_list, remove_memberactivities=remove_memberactivities, + graph_schema=graph_schema, ) else: logging.warning("Testing mode enabled! Not saving any data") def run_operations_transaction( - self, platform_id: str, queries_list: list[Query], remove_memberactivities: bool + self, + platform_id: str, + queries_list: list[Query], + remove_memberactivities: bool, + graph_schema: GraphSchema, ) -> None: """ do the deletion and insertion operations inside a transaction @@ -119,7 +124,8 @@ def run_operations_transaction( f"{self.guild_msg} Neo4J platform_id accounts relation will be removed!" ) delete_relationship_query = self._create_guild_rel_deletion_query( - platform_id=platform_id + platform_id=platform_id, + graph_schema=graph_schema, ) transaction_queries.append(delete_relationship_query) @@ -128,7 +134,10 @@ def run_operations_transaction( self.neo4j_ops.run_queries_in_batch(transaction_queries, message=self.guild_msg) def _create_guild_rel_deletion_query( - self, platform_id: str, relation_name: str = "INTERACTED_WITH" + self, + platform_id: str, + graph_schema: GraphSchema, + relation_name: str = "INTERACTED_WITH", ) -> Query: """ create a query to delete the relationships @@ -148,8 +157,8 @@ def _create_guild_rel_deletion_query( """ query_str = f""" MATCH - (:DiscordAccount) - -[r:{relation_name} {{platformId: '{platform_id}'}}]-(:DiscordAccount) + (:{graph_schema.user_label}) + -[r:{graph_schema.interacted_with_rel} {{platformId: '{platform_id}'}}]-(:{graph_schema.user_label}) DETACH DELETE r""" parameters = { From 4f38cd3607cb9b97cc4092dd269ef5cd3c4e4fc6 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Thu, 12 Sep 2024 17:33:13 +0330 Subject: [PATCH 2/2] feat: bump lib version! --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4c12d39..9a85b2f 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="tc-analyzer-lib", - version="1.4.7", + version="1.4.8", author="Mohammad Amin Dadgar, TogetherCrew", maintainer="Mohammad Amin Dadgar", maintainer_email="dadgaramin96@gmail.com",