[PR #51] [MERGED] Update SQL agents to use read-only connections #53

Closed
opened 2026-02-15 19:15:33 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/streamlit-agent/pull/51
Author: @sfc-gh-jcarroll
Created: 2/7/2024
Status: Merged
Merged: 2/8/2024
Merged by: @sfc-gh-jcarroll

Base: mainHead: sql-readonly


📝 Commits (1)

  • 4592ddd Update SQL agents to use read-only connections

📊 Changes

2 files changed (+24 additions, -3 deletions)

View changed files

📝 streamlit_agent/chat_with_sql_db.py (+16 -2)
📝 streamlit_agent/mrkl_demo.py (+8 -1)

📄 Description

  • Use a small SQLAlchemy workaround to make mrkl and chat_with_sql examples use a read-only SQLite connection
  • Add a warning on chat_with_sql to use limited permissions for any custom database connection and link to LangChain security page.

I tested and confirmed on both apps, if the LLM generates a write instruction (like DROP TABLE) it now throws an error instead of successfully executing the query.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/streamlit-agent/pull/51 **Author:** [@sfc-gh-jcarroll](https://github.com/sfc-gh-jcarroll) **Created:** 2/7/2024 **Status:** ✅ Merged **Merged:** 2/8/2024 **Merged by:** [@sfc-gh-jcarroll](https://github.com/sfc-gh-jcarroll) **Base:** `main` ← **Head:** `sql-readonly` --- ### 📝 Commits (1) - [`4592ddd`](https://github.com/langchain-ai/streamlit-agent/commit/4592ddd1c3fc01807966cd78fa5f3a8734e92498) Update SQL agents to use read-only connections ### 📊 Changes **2 files changed** (+24 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `streamlit_agent/chat_with_sql_db.py` (+16 -2) 📝 `streamlit_agent/mrkl_demo.py` (+8 -1) </details> ### 📄 Description - Use a small SQLAlchemy workaround to make mrkl and chat_with_sql examples use a read-only SQLite connection - Add a warning on chat_with_sql to use limited permissions for any custom database connection and link to LangChain security page. I tested and confirmed on both apps, if the LLM generates a write instruction (like `DROP TABLE`) it now throws an error instead of successfully executing the query. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 19:15:33 -05:00
yindo closed this issue 2026-02-15 19:15:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/streamlit-agent#53