Skip to content

Commit 0f5820f

Browse files
authored
Ensure trailing semicolon is removed before appending LIMIT clause.
1 parent 386df86 commit 0f5820f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mcp_server_snowflake/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ async def handle_execute_query(
380380
# Ensure the query has a LIMIT clause to prevent large result sets
381381
# Parse the query to check if it already has a LIMIT
382382
if "LIMIT " not in query.upper():
383-
query = f"{query} LIMIT {limit_rows}"
383+
# Remove any trailing semicolon before adding the LIMIT clause
384+
query = query.rstrip().rstrip(';')
385+
query = f"{query} LIMIT {limit_rows};"
384386

385387
# Execute the query
386388
cursor = conn.cursor()

0 commit comments

Comments
 (0)