dn-scribe commited on
Commit
fb4c25c
·
unverified ·
2 Parent(s): cfad39cfe37f29

Merge pull request #11 from scribe-security/sh-8291-risk-dataset

Browse files
scribe_python_client/client.py CHANGED
@@ -929,19 +929,6 @@ class ScribeClient:
929
 
930
  }
931
 
932
- def create_lineage_graph(self, lineage_data):
933
- # Determine allowed asset types from the data.
934
- # all_types = {record.get("asset_type") for record in lineage_data if record.get("asset_type")}
935
- # # Exclude unwanted types.
936
- # exclude_types = {"user", "secret", "org_secret", "commit", "actor", "build_machine"}
937
- # include_types = all_types - exclude_types
938
-
939
- # # Define the mapping for layering.
940
-
941
- # # Generate and display the network visualization.
942
- # fig = lineage_graph.visualize_network(lineage_data, include_types, self.types_to_position)
943
- logging.error("create_lineage_graph is not supported in the python package.")
944
- return None
945
 
946
  include_fields = [
947
  "platform_name", "platform_type",
@@ -1039,6 +1026,24 @@ class ScribeClient:
1039
  return f"{title}\n{self.format_query_result_table(r)}"
1040
  return "Error running query"
1041
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1042
  def query_lineage(self, querystr, title="", graph_filename=None) -> str:
1043
  logging.debug(f"Query lineage with: {querystr}")
1044
  query = self.querystr_to_json(querystr)
 
929
 
930
  }
931
 
 
 
 
 
 
 
 
 
 
 
 
 
 
932
 
933
  include_fields = [
934
  "platform_name", "platform_type",
 
1026
  return f"{title}\n{self.format_query_result_table(r)}"
1027
  return "Error running query"
1028
 
1029
+ def get_lineage_graph(self, lineage_data, output_file):
1030
+ """
1031
+ Generate a lineage graph from the lineage data and save it to the specified output file.
1032
+
1033
+ Parameters:
1034
+ lineage_data (list): List of lineage records.
1035
+ output_file (str): Path to save the generated graph.
1036
+
1037
+ Returns:
1038
+ str: Full path of the saved graph file.
1039
+ """
1040
+ if not lineage_data:
1041
+ logging.error("No lineage data provided for graph generation.")
1042
+ return "Error: No lineage data provided."
1043
+
1044
+ full_path_filename = create_lineage_graph(lineage_data, output_file=output_file)
1045
+ return full_path_filename
1046
+
1047
  def query_lineage(self, querystr, title="", graph_filename=None) -> str:
1048
  logging.debug(f"Query lineage with: {querystr}")
1049
  query = self.querystr_to_json(querystr)
scribe_python_client/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.1"
 
1
+ __version__ = "0.2.2"