Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion sqlalchemy_kusto/dialect_kql.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,21 @@ def _escape_and_quote_columns(name: str | None, is_alias=False) -> str:
col_part = col_part[1:-1].strip()
col_part = col_part.replace('"', '\\"')
return f'["{col_part}"] {operator} {parts[1].strip()}' # Wrap the column part
# No operators found, just wrap the entire name

# If the alias starts with the keys in aggregates_sql_to_kql replace it with the values
if is_alias:
for key, value in aggregates_sql_to_kql.items():
logger.debug(
"Aliases and Names in escaping: %s and "
"Key is %s and Value is %s",
name,
key,
value,
)
if key.startswith(name.lower()):
name = value
break
# No operators found, just wrap the entire name
name = name.replace('"', '\\"')
return f'["{name}"]'

Expand Down