Random WFA, Powershell, DFSutil.exe, and OCI Notes - 12 May 2020

Integrating NetApp WFA with MySQL

If you google “Invoke-MySQLQuery” you will come across a gallery.technet.microsoft.com article like:

With this installed on your WFA server, you can enter something like the below into a Command Definition that does some SQL Query stuff:

$TestQuery = "SELECT scheme1.table1.something1,
              scheme1.table1.something2
              FROM scheme1.table1 as S
              JOIN scheme2.table1 as T ON S.tid = T.id
              WHERE S.something3 = 'something_to_search_for';"

$SQLquery = Invoke-MySqlQuery -query $TestQuery

If (-not $SQLquery -gt 1){
  throw "Didn’t find anything!"
}

Running DFSutil.exe in WFA - Some Examples

## Checking for Existence of Link ##
$DFSCommand = "link `"" + $dfsLink + "`""
$proc = start-process dfsutil.exe -ArgumentList $DFSCommand -wait -PassThru

## Adding Link ##
$DFSCommand = "link add " + "`"" + $dfsLink + "`"" + " `"" + $dfsTarget + "`""
$proc = start-process dfsutil.exe -ArgumentList $DFSCommand -wait -PassThru

## Target Add ##
$DFSCommand = "target add " + "`"" + $dfsLink + "`"" + " `"" + $dfsTarget + "`""
$proc = start-process dfsutil.exe -ArgumentList $DFSCommand -wait -PassThru

## Setting Priority Class ##
$DFSCommand = "property PriorityClass set " + "`"" + $dfsLink + "`"" + " `"" + $dfsTarget + "`" " + $priority
$proc = start-process dfsutil.exe -ArgumentList $DFSCommand -wait -PassThru

OCI DWH Getting the Latest TK from Date_Dimension (Latest Date in OCI DWH)

use dwh_capacity;
select tk from date_dimension where latest = 1;

Image: Getting the Latest TK from Date Dimension (MySQL Workbench)

OCI DWH Understanding date_dimension

Note: The date_dimension table exists in the following schemas:
dwh_capacity, dwh_capacity_efficiency, dwh_performance.

There is only ever one date entry with ‘latest’ = 1. Below is date_dimension described (describe date_dimension), and I have added a column with example data.

mysql> use dwh_capacity;
Database changed
mysql> describe date_dimension;
----------------+------------+-----+----+-------+---------------------+
Field           |Type        |Null |Key |Default| Example Data        |
----------------+------------+-----+----+-------+---------------------+
tk              | int(11)    | NO  |    | 0     | 358                 |
fullDate        | datetime   | NO  |    | NULL  | 2017-05-08 00:00:00 |
dayInMonth      | tinyint(4) | NO  |    | NULL  | 8                   |
dayInYear       | smallint(6)| NO  |    | NULL  | 128                 |
dateYear        | smallint(6)| NO  |    | NULL  | 2017                |
yearLabel       | char(4)    | NO  |    | NULL  | 2017                |
monthNum        | tinyint(4) | NO  |    | NULL  | 5                   |
monthLabel      | char(7)    | NO  |    | NULL  | 2017/05             |
dayInWeekNum    | tinyint(4) | NO  |    | NULL  | 2                   |
quarter         | tinyint(4) | NO  |    | NULL  | 2                   |
quarterLabel    | char(7)    | NO  |    | NULL  | 2017/Q2             |
dayInQuarter    | smallint(6)| NO  |    | NULL  | 38                  |
repQuarter      | tinyint(4) | NO  |    | NULL  | 0                   |
repMonth        | tinyint(4) | NO  |    | NULL  | 0                   |
repWeek         | tinyint(4) | NO  |    | NULL  | 0                   |
repDay          | tinyint(4) | NO  |    | NULL  | 1                   |
repMonthOrLatest| tinyint(4) | NO  |    | NULL  | 1                   |
sspFlag         | tinyint(4) | NO  |    | NULL  | 1                   |
latest          | char(1)    | YES |    | NULL  | 1                   |
future          | char(1)    | NO  |    | 0     | 0                   |
----------------+------------+-----+----+-------+---------------------+

Comments