You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -23,7 +23,7 @@ To establish a connection between a Mendix AI Agent and a Snowflake-managed MCP
23
23
24
24
Alternatively, to start from scratch or to add the capability to an exsiting application, you must also install the following modules and their prerequisites:
25
25
26
-
*[MCP Client](https://marketplace.mendix.com/link/component/244893) (version 3.1.0 or higher)
26
+
*[MCP Client](https://marketplace.mendix.com/link/component/244893) (version 3.1.0 or newer)
return json.dumps({"status": "error", "message": f"Column '{col_name}' does not exist in {fully_qualified_table}", "valid_columns": list(schema_info.keys())})
123
-
col_names = list(values.keys())
124
-
val_parts = []
125
-
for col in col_names:
126
-
val = values[col]
127
-
if val is None:
128
-
val_parts.append("NULL")
129
-
elif isinstance(val, (int, float)):
130
-
val_parts.append(str(val))
131
-
else:
132
-
escaped = str(val).replace("'", "''")
133
-
val_parts.append(f"'{escaped}'")
134
-
col_list = ", ".join(col_names)
135
-
val_list = ", ".join(val_parts)
136
-
sql = f"INSERT INTO {fully_qualified_table} ({col_list}) VALUES ({val_list})"
137
-
try:
138
-
session.sql(sql).collect()
139
-
return json.dumps({"status": "success", "message": f"Record inserted into {fully_qualified_table}", "columns_inserted": col_names})
*[Procedure to Insert Records](#code-records-insert)
146
44
147
45
3. Create the Snowflake MCP server exposing the stored procedures as tools.
148
46
For more information, see [Create an MCP Server object](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents-mcp#create-an-mcp-server-object) in Snowflake documentation.
return json.dumps({"status": "error", "message": f"Column '{col_name}' does not exist in {fully_qualified_table}", "valid_columns": list(schema_info.keys())})
374
+
col_names = list(values.keys())
375
+
val_parts = []
376
+
for col in col_names:
377
+
val = values[col]
378
+
if val is None:
379
+
val_parts.append("NULL")
380
+
elif isinstance(val, (int, float)):
381
+
val_parts.append(str(val))
382
+
else:
383
+
escaped = str(val).replace("'", "''")
384
+
val_parts.append(f"'{escaped}'")
385
+
col_list = ", ".join(col_names)
386
+
val_list = ", ".join(val_parts)
387
+
sql = f"INSERT INTO {fully_qualified_table} ({col_list}) VALUES ({val_list})"
388
+
try:
389
+
session.sql(sql).collect()
390
+
return json.dumps({"status": "success", "message": f"Record inserted into {fully_qualified_table}", "columns_inserted": col_names})
0 commit comments