From 4527362492dab1b35e2ced37e634db774a3af1c5 Mon Sep 17 00:00:00 2001 From: Kyle Scully Date: Mon, 21 Aug 2023 12:10:30 -0700 Subject: [PATCH] feat(sql_crud): add option to filter operations --- .../cobol_relationships.ipynb | 4 +++- .../cobol_relationships_data_grid.ipynb | 2 +- moderne_visualizations_misc/specs/sql_crud.yml | 6 ++++++ moderne_visualizations_misc/sql_crud.ipynb | 17 +++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/moderne_visualizations_misc/cobol_relationships.ipynb b/moderne_visualizations_misc/cobol_relationships.ipynb index 9f22816..2efc538 100644 --- a/moderne_visualizations_misc/cobol_relationships.ipynb +++ b/moderne_visualizations_misc/cobol_relationships.ipynb @@ -13,7 +13,7 @@ "outputs": [], "source": [ "node_shape: str = \"ellipse\"\n", - "filter_resources_related_to: str = \"\"\n" + "filter_resources_related_to: str = \"\"" ] }, { @@ -106,12 +106,14 @@ " ),\n", " )\n", "\n", + "\n", "def makeNode(resource, type):\n", " if isinstance(resource, str) and isinstance(type, str):\n", " return resource + \" \" + type\n", " else:\n", " return resource\n", "\n", + "\n", "def makeLabel(action, actionMetadata):\n", " if isinstance(actionMetadata, str):\n", " return action + \" \" + f\"({actionMetadata})\"\n", diff --git a/moderne_visualizations_misc/cobol_relationships_data_grid.ipynb b/moderne_visualizations_misc/cobol_relationships_data_grid.ipynb index a9c19ab..f3b9f58 100644 --- a/moderne_visualizations_misc/cobol_relationships_data_grid.ipynb +++ b/moderne_visualizations_misc/cobol_relationships_data_grid.ipynb @@ -12,7 +12,7 @@ }, "outputs": [], "source": [ - "filter_resources_related_to: str = \"\"\n" + "filter_resources_related_to: str = \"\"" ] }, { diff --git a/moderne_visualizations_misc/specs/sql_crud.yml b/moderne_visualizations_misc/specs/sql_crud.yml index aaa2f25..26de879 100644 --- a/moderne_visualizations_misc/specs/sql_crud.yml +++ b/moderne_visualizations_misc/specs/sql_crud.yml @@ -5,3 +5,9 @@ displayName: SQL operation usage in code description: This report shows the SQL operation usages across the projects. It is a good way to understand the SQL usage patterns and identify call sites. recipe: org.openrewrite.sql.FindSql dataTable: org.openrewrite.sql.table.DatabaseColumnsUsed +options: + - filter_operations_to: + displayName: Filter to specific operations + description: > + Enter the name of the operation you want to subset the data table to. + required: false diff --git a/moderne_visualizations_misc/sql_crud.ipynb b/moderne_visualizations_misc/sql_crud.ipynb index 95a4b70..17f3696 100644 --- a/moderne_visualizations_misc/sql_crud.ipynb +++ b/moderne_visualizations_misc/sql_crud.ipynb @@ -1,5 +1,18 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "filter_operations_to: list[str] = []" + ] + }, { "cell_type": "code", "execution_count": null, @@ -11,6 +24,10 @@ "from code_data_science import data_table as dt, data_grid as moderne_data_grid\n", "\n", "df = dt.read_csv(\"../samples/sql_crud.csv\")\n", + "\n", + "if len(filter_operations_to) > 0:\n", + " df = df[df[\"operation\"].isin(filter_operations_to)]\n", + "\n", "df = df.rename(\n", " columns={\n", " \"repositoryOrigin\": \"Origin\",\n",