Skip to content

Commit

Permalink
#98 - adding KQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Amos Rimon committed Jul 6, 2020
1 parent 1cdfbc0 commit 3f1e4c4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pykusto/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def month_of_year(date: DatetimeType) -> NumberExpression:
"""
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/monthofyearfunction
"""
return NumberExpression(f"monthofyear({to_kql(date)})")
return NumberExpression(KQL(f"monthofyear({to_kql(date)})"))

@staticmethod
def new_guid() -> AnyExpression:
Expand Down Expand Up @@ -558,7 +558,7 @@ def pack_all() -> MappingExpression:
"""
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/packallfunction
"""
return MappingExpression("pack_all()")
return MappingExpression(KQL("pack_all()"))

@staticmethod
def pack_array(*elements: ExpressionType) -> 'ArrayExpression':
Expand All @@ -572,7 +572,7 @@ def pack_dictionary() -> MappingExpression:
"""
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/packdictionaryfunction
"""
return MappingExpression("pack_dictionary()")
return MappingExpression(KQL("pack_dictionary()"))

#
#
Expand Down Expand Up @@ -993,7 +993,7 @@ def to_dynamic(json: StringType) -> DynamicExpression:
"""
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/todynamicfunction
"""
return DynamicExpression(f"todynamic({to_kql(json)})")
return DynamicExpression(KQL(f"todynamic({to_kql(json)})"))

@staticmethod
def to_guid() -> AnyExpression:
Expand Down Expand Up @@ -1049,7 +1049,7 @@ def to_timespan(expr: StringType) -> TimespanExpression:
"""
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/totimespanfunction
"""
return TimespanExpression(f"totimespan({to_kql(expr)})")
return TimespanExpression(KQL(f"totimespan({to_kql(expr)})"))

@staticmethod
def to_upper(expr: StringType) -> StringExpression:
Expand All @@ -1071,7 +1071,7 @@ def trim(regex: StringType, text: StringType) -> StringExpression:
"""
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/trimfunction
"""
return StringExpression(f"trim({to_kql(regex)}, {to_kql(text)})")
return StringExpression(KQL(f"trim({to_kql(regex)}, {to_kql(text)})"))

# def trim_end(self): return
#
Expand Down

0 comments on commit 3f1e4c4

Please sign in to comment.