Skip to content

Commit 6a6fbf1

Browse files
authored
Merge pull request #3 from siva-suthan/main
Ensure trailing semicolon is removed before appending LIMIT clause in handle_execute_query
2 parents 386df86 + 0f5820f commit 6a6fbf1

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)