Skip to content

Commit 68e68c2

Browse files
removed count(*) examples
1 parent 9396ae2 commit 68e68c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/uipath_langchain/agent/tools/datafabric_tool/datafabric_tool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,12 @@ def format_schemas_for_context(entities: list[Entity]) -> str:
192192
lines.append(
193193
f"| 'Top N by Y' | `SELECT {fields_sample} FROM {sql_table} ORDER BY {agg_field} DESC LIMIT N` |"
194194
)
195+
count_col = field_names[0] if field_names else "id"
195196
lines.append(
196-
f"| 'Count by X' | `SELECT {group_field}, COUNT(*) as count FROM {sql_table} GROUP BY {group_field}` |"
197+
f"| 'Count by X' | `SELECT {group_field}, COUNT({count_col}) as count FROM {sql_table} GROUP BY {group_field}` |"
197198
)
198199
lines.append(
199-
f"| 'Top N segments' | `SELECT {group_field}, COUNT(*) as count FROM {sql_table} GROUP BY {group_field} ORDER BY count DESC LIMIT N` |"
200+
f"| 'Top N segments' | `SELECT {group_field}, COUNT({count_col}) as count FROM {sql_table} GROUP BY {group_field} ORDER BY count DESC LIMIT N` |"
200201
)
201202
lines.append(
202203
f"| 'Sum/Avg of Y' | `SELECT SUM({agg_field}) as total FROM {sql_table}` |"

0 commit comments

Comments
 (0)