GUID is now supported by Kusto.

Although it should be converted to "uuid" python type we will treat it as string to enable quick mitigation
This commit is contained in:
Ofri Kleinfeld 2022-03-31 12:47:14 +03:00
Родитель 46fcdbbd01
Коммит f713354756
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -407,7 +407,7 @@ class _NumberExpression(BaseExpression):
return _NumberExpression(KQL(f'round({self.kql})' if precision is None else f'round({self.kql}, {_to_kql(precision)})'))
@_plain_expression(_KustoType.STRING)
@_plain_expression(_KustoType.STRING, _KustoType.GUID)
class _StringExpression(BaseExpression):
# We would like to allow using len(), but Python requires it to return an int, so we can't
def string_size(self) -> _NumberExpression:
@ -894,7 +894,7 @@ class _NumberAggregationExpression(AggregationExpression, _NumberExpression):
pass
@_aggregation_expression(_KustoType.STRING)
@_aggregation_expression(_KustoType.STRING, _KustoType.GUID)
class _StringAggregationExpression(AggregationExpression, _StringExpression):
pass
@ -1013,7 +1013,7 @@ class _DynamicColumn(_ArrayColumn, _MappingColumn):
pass
@_typed_column(_KustoType.STRING)
@_typed_column(_KustoType.STRING, _KustoType.GUID)
class _StringColumn(BaseColumn, _StringExpression):
pass

Просмотреть файл

@ -49,7 +49,7 @@ def _bool_to_kql(b: bool) -> KQL:
return KQL('true') if b else KQL('false')
@_kql_converter(_KustoType.STRING)
@_kql_converter(_KustoType.STRING, _KustoType.GUID)
def _str_to_kql(s: str) -> KQL:
return KQL(f'"{s}"')

Просмотреть файл

@ -20,7 +20,7 @@ class _KustoType(Enum):
STRING = ('string', 'StringBuffer', 'System.String', str)
TIMESPAN = ('timespan', 'TimeSpan', 'System.TimeSpan', timedelta)
DECIMAL = ('decimal', 'Decimal', 'System.Data.SqlTypes.SqlDecimal', int)
GUID = ('guid', 'UniqueId', 'System.Guid') # Not supported by Kusto yet
GUID = ('guid', 'UniqueId', 'System.Guid', str) # Converted to string and not uuid for now
# Deprecated types, kept here for back compatibility
# https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/unsupported-data-types