Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is
one of dependencies and versions, and indirectly permissions.
With virtualenv, it’s possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.
Contributions to this library are always welcome and highly encouraged.
See CONTRIBUTING for more information how to get started.
Please note that this project is released with a Contributor Code of Conduct. By participating in
this project you agree to abide by its terms. See Code of Conduct for more
information.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [0.3.0 (latest)](/python/docs/reference/langchain-google-cloud-sql-mssql/latest)\n- [0.2.1](/python/docs/reference/langchain-google-cloud-sql-mssql/0.2.1) \n\nCloud SQL for SQL Server for LangChain\n======================================\n\n[](https://cloud.google.com/products#product-launch-stages) [](https://pypi.org/project/langchain-google-cloud-sql-mssql/) [](https://pypi.org/project/langchain-google-cloud-sql-mssql/)\n\n- [Client Library Documentation](https://cloud.google.com/python/docs/reference/langchain-google-cloud-sql-mssql/latest)\n\n- [Product Documentation](https://cloud.google.com/sql/sqlserver)\n\nQuick Start\n-----------\n\nIn order to use this library, you first need to go through the following\nsteps:\n\n1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)\n\n2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)\n\n3. [Enable the Google Cloud SQL Admin API.](https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com)\n\n4. [Setup Authentication.](https://googleapis.dev/python/google-api-core/latest/auth.html)\n\n### Installation\n\nInstall this library in a [virtualenv](https://virtualenv.pypa.io/en/latest/) using pip. [virtualenv](https://virtualenv.pypa.io/en/latest/) is a tool to create isolated Python environments. The basic problem it addresses is\none of dependencies and versions, and indirectly permissions.\n\nWith [virtualenv](https://virtualenv.pypa.io/en/latest/), it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.\n\n#### Supported Python Versions\n\nPython \\\u003e= 3.9\n\n#### Mac/Linux\n\n pip install virtualenv\n virtualenv \u003cyour-env\u003e\n source \u003cyour-env\u003e/bin/activate\n \u003cyour-env\u003e/bin/pip install langchain-google-cloud-sql-mssql\n\n#### Windows\n\n pip install virtualenv\n virtualenv \u003cyour-env\u003e\n \u003cyour-env\u003e\\Scripts\\activate\n \u003cyour-env\u003e\\Scripts\\pip.exe install langchain-google-cloud-sql-mssql\n\n### Document Loader Usage\n\nUse a document loader to load data as LangChain `Document`s. \n\n from langchain_google_cloud_sql_mssql import MSSQLEngine, MSSQLLoader\n\n engine = MSSQLEngine.from_instance(\"project-id\", \"region\", \"my-instance\", \"my-database\", \"db_user\", \"db_pass\")\n loader = MSSQLLoader(\n engine,\n table_name=\"my-table-name\"\n )\n docs = loader.lazy_load()\n\nSee the full [Document Loader](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/blob/main/docs/document_loader.ipynb) tutorial.\n\n### Chat Message History Usage\n\nUse `ChatMessageHistory` to store messages and provide conversation\nhistory to LLMs. \n\n from langchain_google_cloud_sql_mssql import MSSQLChatMessageHistory, MSSQLEngine\n\n engine = MSSQLEngine.from_instance(\"project-id\", \"region\", \"my-instance\", \"my-database\", \"db_user\", \"db_pass\")\n history = MSSQLChatMessageHistory(\n engine,\n table_name=\"my-message-store\",\n session_id=\"my-session_id\"\n )\n\nSee the full [Chat Message History](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/blob/main/docs/chat_message_history.ipynb) tutorial.\n\n### Contributions\n\nContributions to this library are always welcome and highly encouraged.\n\nSee [CONTRIBUTING](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/blob/main/CONTRIBUTING.md) for more information how to get started.\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in\nthis project you agree to abide by its terms. See [Code of Conduct](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/blob/main/CODE_OF_CONDUCT.md) for more\ninformation.\n\nLicense\n-------\n\nApache 2.0 - See\n[LICENSE](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/blob/main/LICENSE)\nfor more information.\n\nDisclaimer\n----------\n\nThis is not an officially supported Google product."]]