Last active
April 7, 2026 18:02
-
-
Save derrickturk/50f69c0fc7f7a715c3e6d88b8b15cd33 to your computer and use it in GitHub Desktop.
Poke around TMDL model directories ("Blah.SemanticModel/definition") [I did it 37 minutes ago]
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
| using Microsoft.AnalysisServices.Tabular; | |
| using System.Diagnostics; | |
| if (args.Length != 1) { | |
| Console.Error.WriteLine( | |
| $"Usage: {Process.GetCurrentProcess().ProcessName} tmdl-dir"); | |
| return 2; | |
| } | |
| var db = TmdlSerializer.DeserializeModelFromFolder(args[0]); | |
| Console.WriteLine($"Deserialized {db.Name}"); | |
| foreach (var t in db.Tables) { | |
| Console.WriteLine($" Table: {t.Name}"); | |
| foreach (var c in t.Columns) { | |
| Console.WriteLine($" Column: {c.Name} is {c.Type} {c.DataType}"); | |
| } | |
| foreach (var p in t.Partitions) { | |
| Console.WriteLine($" Partition: {p.Name} from {p.SourceType}"); | |
| Console.WriteLine($" {p.Source.ToString()}"); | |
| switch (p.Source) { | |
| case MPartitionSource m: | |
| Console.WriteLine($"{m.Expression}"); | |
| break; | |
| default: | |
| Console.WriteLine("Not an M expression"); | |
| break; | |
| } | |
| } | |
| } | |
| return 0; |
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
| <Project Sdk="Microsoft.NET.Sdk"> | |
| <PropertyGroup> | |
| <OutputType>Exe</OutputType> | |
| <TargetFramework>net10.0</TargetFramework> | |
| <ImplicitUsings>enable</ImplicitUsings> | |
| <Nullable>enable</Nullable> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <PackageReference Include="Microsoft.AnalysisServices" Version="19.113.2" /> | |
| </ItemGroup> | |
| </Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment