Skip to content

Commit

Permalink
more updates to parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Jun 6, 2024
1 parent ec9133e commit ac10ff9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sempy/labs/TOM.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ def all_columns(self):
Returns
-------
Microsoft.AnalysisServices.Tabular.ColumnCollection
Iterator[Microsoft.AnalysisServices.Tabular.Column]
All columns within the semantic model.
"""

for t in self.model.Tables:
for c in t.Columns:
if not str(c.Type) == 'RowNumber':
if c.Type != TOM.ColumnType.RowNumber:
yield c

def all_calculated_columns(self):
Expand All @@ -93,13 +93,13 @@ def all_calculated_columns(self):
Returns
-------
Microsoft.AnalysisServices.Tabular.ColumnCollection
Iterator[Microsoft.AnalysisServices.Tabular.Column]
All calculated columns within the semantic model.
"""

for t in self.model.Tables:
for c in t.Columns:
if str(c.Type) == 'Calculated':
if c.Type == TOM.ColumnType.Calculated:
yield c

def all_calculated_tables(self):
Expand All @@ -112,12 +112,12 @@ def all_calculated_tables(self):
Returns
-------
Microsoft.AnalysisServices.Tabular.TableCollection
Iterator[Microsoft.AnalysisServices.Tabular.Table]
All calculated tables within the semantic model.
"""

for t in self.model.Tables:
if any(str(p.SourceType) == 'Calculated' for p in t.Partitions):
if any(p.SourceType == TOM.ColumnType.Calculated for p in t.Partitions):
yield t

def all_calculation_groups(self):
Expand Down Expand Up @@ -202,7 +202,7 @@ def all_levels(self):
Returns
-------
Microsoft.AnalysisServices.Tabular.LevelCollection
cMicrosoft.AnalysisServices.Tabular.Level]
All levels within the semantic model.
"""

Expand Down Expand Up @@ -1930,7 +1930,7 @@ def is_field_parameter(self, table_name: str):

t = self.model.Tables[table_name]

return any(str(p.SourceType) == 'Calculated' and 'NAMEOF(' in p.Source.Expression for p in t.Partitions) and all('[Value' in c.SourceColumn for c in t.Columns if not str(c.Type) == 'RowNumber') and t.Columns.Count == 4
return any(p.SourceType == TOM.PartitionSourceType.Calculated and 'NAMEOF(' in p.Source.Expression for p in t.Partitions) and all('[Value' in c.SourceColumn for c in t.Columns if c.Type != TOM.ColumnType.RowNumber) and t.Columns.Count == 4

def is_auto_date_table(self, table_name: str):

Expand Down Expand Up @@ -2433,7 +2433,7 @@ def set_vertipaq_annotations(self):
runId = '1'
self.set_annotation(object = self.model, name = 'Vertipaq_Run', value = runId)

def row_count(self, object):
def row_count(self, object: Union['TOM.Partition', 'TOM.Table']):

"""
Obtains the row count of a table or partition within a semantic model.
Expand All @@ -2458,7 +2458,7 @@ def row_count(self, object):

return int(result)

def records_per_segment(self, object):
def records_per_segment(self, object: 'TOM.Partition'):

"""
Obtains the records per segment of a partition within a semantic model.
Expand Down

0 comments on commit ac10ff9

Please sign in to comment.