From f3180f05f91f5a0bd84d38b90ae3b4ea49689a12 Mon Sep 17 00:00:00 2001 From: Jon Luo <20971593+jzluo@users.noreply.github.com> Date: Thu, 13 Apr 2023 14:46:59 -0400 Subject: [PATCH] Update sql chain notebook to clarify use of SQLAlchemy for connections (#2850) Have seen questions about whether or not the `SQLDatabaseChain` supports more than just sqlite, which was unclear in the docs, so tried to clarify that and how to connect to other dialects. --- docs/modules/chains/examples/sqlite.ipynb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/modules/chains/examples/sqlite.ipynb b/docs/modules/chains/examples/sqlite.ipynb index a4b33f04b8..b3b23eb43d 100644 --- a/docs/modules/chains/examples/sqlite.ipynb +++ b/docs/modules/chains/examples/sqlite.ipynb @@ -9,9 +9,9 @@ } }, "source": [ - "# SQLite example\n", + "# SQL Chain example\n", "\n", - "This example showcases hooking up an LLM to answer questions over a database." + "This example demonstrates the use of the `SQLDatabaseChain` for answering questions over a database." ] }, { @@ -23,8 +23,10 @@ } }, "source": [ - "This uses the example Chinook database.\n", - "To set it up follow the instructions on https://database.guide/2-sample-databases-sqlite/, placing the `.db` file in a notebooks folder at the root of this repository." + "Under the hood, LangChain uses SQLAlchemy to connect to SQL databases. The `SQLDatabaseChain` can therefore be used with any SQL dialect supported by SQLAlchemy, such as MS SQL, MySQL, MariaDB, PostgreSQL, Oracle SQL, and SQLite. Please refer to the SQLAlchemy documentation for more information about requirements for connecting to your database. For example, a connection to MySQL requires an appropriate connector such as PyMySQL. A URI for a MySQL connection might look like: `mysql+pymysql://user:pass@some_mysql_db_address/db_name`\n", + "\n", + "This demonstration uses SQLite and the example Chinook database.\n", + "To set it up, follow the instructions on https://database.guide/2-sample-databases-sqlite/, placing the `.db` file in a notebooks folder at the root of this repository." ] }, { @@ -679,7 +681,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.1" + "version": "3.10.10" } }, "nbformat": 4,