This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Client from 'some-database-api'; | |
| import { connectionInfo } from './config'; | |
| class AsyncDatabaseClient { | |
| constructor() { | |
| this._connection = null; | |
| this._initialized = Client.connect(connectionInfo).then(c => this.connection = c); | |
| return new Proxy(this, { | |
| get(target, prop, receiver) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; | |
| string SizeSuffix(long value, int decimalPlaces = 0) | |
| { | |
| if (value < 0) | |
| { | |
| throw new ArgumentException("Bytes should not be negative", "value"); | |
| } | |
| var mag = (int)Math.Max(0, Math.Log(value, 1024)); | |
| var adjustedSize = Math.Round(value / Math.Pow(1024, mag), decimalPlaces); | |
| return $"{adjustedSize} {SizeSuffixes[mag]}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Query Kind="Statements"> | |
| <Namespace>System.Collections.Concurrent</Namespace> | |
| <Namespace>System.Threading.Tasks</Namespace> | |
| <Namespace>System.Threading.Tasks.Dataflow</Namespace> | |
| </Query> | |
| var produceSpeed = TimeSpan.FromSeconds(0.5); | |
| var produceCount = 20; | |
| var consumeSpeed = TimeSpan.FromSeconds(2); | |
| var maxParallelConsume = 4; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code is still WIP, it doesn't entirely filter the lineage. Feel free to make adjustments. | |
| string dependancies = "::: mermaid\ngraph LR;\n%% Measure dependancy mermaid flowchart"; | |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| foreach(var _measures in Model.AllMeasures ) | |
| { | |
| // Deep lineage for upstream measures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code is still WIP, it doesn't entirely filter the lineage. Feel free to make adjustments. | |
| string dependancies = "flowchart LR\n%% Measure dependancy mermaid flowchart"; | |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
| foreach(var _measures in Model.AllMeasures ) | |
| { | |
| // Deep lineage for upstream measures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######################################################################################### | |
| # Authentication - Replace string variables with your relevant values | |
| ######################################################################################### | |
| import json, requests, pandas as pd | |
| try: | |
| from azure.identity import ClientSecretCredential | |
| except Exception: | |
| !pip install azure.identity | |
| from azure.identity import ClientSecretCredential |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string dependancies = "flowchart LR\n%% Measure dependancy mermaid flowchart"; | |
| foreach(var _measures in Model.AllMeasures ) | |
| { | |
| var _upstream = _measures.DependsOn; | |
| var _upstream_measures = _upstream.Measures.OfType<Measure>().Select(c => c).Distinct(); | |
| dependancies += string.Format("\r\n\n%% [{1}] Dependancies:\n\t{0}[\"{1}\"]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Count calculation groups & calculation items | |
| int _calcgroups = 0; | |
| int _calcitems = 0; | |
| foreach ( var _calcgroup in Model.CalculationGroups ) | |
| { | |
| _calcgroups = _calcgroups + 1; | |
| foreach ( var _item in _calcgroup.CalculationItems ) | |
| { | |
| _calcitems = _calcitems + 1; | |
| } |
NewerOlder