Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Changes to support Snowhouse-generated ACCOUNT_USAGE views
Browse files Browse the repository at this point in the history
Added ability to pull ACCOUNT_USAGE views from Snowhouse and process offline
  • Loading branch information
danielodievich committed Feb 23, 2021
1 parent 282fec3 commit 40a3947
Show file tree
Hide file tree
Showing 8 changed files with 835 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net5.0/SnowGrantReport.dll",
"args": ["-c", "sfpscogs_dodievich_sso.west-us-2.azure", "-o", "C:\\snowflake\\GrantReport\\Reports\\dodievich"],
// "args": ["-i", "C:\\snowflake\\GrantReport\\Reports\\Account_Usage_Input", "-o", "C:\\snowflake\\GrantReport\\Reports\\Account_Usage_Input_Output"],
//"args": ["-c", "sfpscogs_dodievich_sso.west-us-2.azure", "-o", "C:\\snowflake\\GrantReport\\Reports\\instacart.carrot.snowhouse"],
"args": ["-i", "C:\\snowflake\\GrantReport\\ACCOUNT_USAGE_INPUT\\INSTACART_CARROT_Snowhouse", "-o", "C:\\snowflake\\GrantReport\\Reports\\instacart.carrot.snowhouse"],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "externalTerminal",
Expand Down
4 changes: 2 additions & 2 deletions ProcessingSteps/Index/IndexGrantDetailsAccountUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override bool Execute(ProgramOptions programOptions)

List<RoleMember> grantsOfRolesList = new List<RoleMember>();

List<Grant> grantsOnRolesList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Input_RoleShowGrantsToAndOn_FilePath(), new GrantGrantToRolesMap());
List<Grant> grantsOnRolesList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Input_RoleShowGrantsToAndOn_FilePath(), new GrantGrantToRolesMap(), "Initiating login request with your identity provider");

if (grantsOnRolesList != null)
{
Expand Down Expand Up @@ -330,7 +330,7 @@ public override bool Execute(ProgramOptions programOptions)

loggerConsole.Info("Process Grants OF Users");

List<RoleMember> grantsOfUsersList = FileIOHelper.ReadListFromCSVFile<RoleMember>(FilePathMap.Input_RoleShowGrantsOf_FilePath(), new RoleMemberGrantsToUsersMap());
List<RoleMember> grantsOfUsersList = FileIOHelper.ReadListFromCSVFile<RoleMember>(FilePathMap.Input_RoleShowGrantsOf_FilePath(), new RoleMemberGrantsToUsersMap(), "Initiating login request with your identity provider");
if (grantsOfUsersList != null)
{
foreach (RoleMember roleMember in grantsOfUsersList)
Expand Down
10 changes: 5 additions & 5 deletions ProcessingSteps/JobStepBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,19 @@ public Account buildObjectHierarchyWithGrants()

// Load selected types of grants to visualize
List<Grant> grantsToAccountList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Report_RoleGrant_ObjectType_FilePath("ACCOUNT"), new GrantMap());
loggerConsole.Trace("Grants in Accounts {0}", grantsToAccountList.Count);
if (grantsToAccountList != null) loggerConsole.Trace("Grants in Accounts {0}", grantsToAccountList.Count);

List<Grant> grantsToDatabaseList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Report_RoleGrant_ObjectType_FilePath("DATABASE"), new GrantMap());
loggerConsole.Trace("Grants in Databases {0}", grantsToDatabaseList.Count);
if (grantsToDatabaseList != null) loggerConsole.Trace("Grants in Databases {0}", grantsToDatabaseList.Count);

List<Grant> grantsToSchemaList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Report_RoleGrant_ObjectType_FilePath("SCHEMA"), new GrantMap());
loggerConsole.Trace("Grants in Schemas {0}", grantsToSchemaList.Count);
if (grantsToSchemaList != null) loggerConsole.Trace("Grants in Schemas {0}", grantsToSchemaList.Count);

List<Grant> grantsToTableList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Report_RoleGrant_ObjectType_FilePath("TABLE"), new GrantMap());
loggerConsole.Trace("Grants in Tables {0}", grantsToTableList.Count);
if (grantsToTableList != null) loggerConsole.Trace("Grants in Tables {0}", grantsToTableList.Count);

List<Grant> grantsToViewList = FileIOHelper.ReadListFromCSVFile<Grant>(FilePathMap.Report_RoleGrant_ObjectType_FilePath("VIEW"), new GrantMap());
loggerConsole.Trace("Grants in Views {0}", grantsToViewList.Count);
if (grantsToViewList!= null) loggerConsole.Trace("Grants in Views {0}", grantsToViewList.Count);

Account account = new Account();
account.FullName = "TODO";
Expand Down
6 changes: 3 additions & 3 deletions Snowflake.GrantReport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<AssemblyName>SnowGrantReport</AssemblyName>
<RootNamespace>Snowflake.GrantReport</RootNamespace>

<Version>2021.2.12.0</Version>
<FileVersion>2021.2.12.0</FileVersion>
<AssemblyVersion>2021.2.12.0</AssemblyVersion>
<Version>2021.2.23.0</Version>
<FileVersion>2021.2.23.0</FileVersion>
<AssemblyVersion>2021.2.23.0</AssemblyVersion>
<Authors>Daniel Odievich ([email protected])</Authors>
<Company>Snowflake Computing</Company>
<Product>Snowflake Grant Report</Product>
Expand Down
8 changes: 0 additions & 8 deletions Snowflake.GrantReport.json

This file was deleted.

Loading

0 comments on commit 40a3947

Please sign in to comment.