Name | langchain-azure-postgresql JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | LangChain VectorStore integrations for Azure Database for PostgreSQL |
upload_time | 2025-08-15 07:50:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | ~=3.10 |
license | MIT License
Copyright (c) 2025 Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
azure
database
langchain
postgresql
vectorstore
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# langchain-azure-postgresql
`langchain-azure-postgresql` is a Python package that implements both asynchronous
and synchronous `VectorStore` support for Azure Database for PostgreSQL. Specifically,
this package adds support for
1. Microsoft Entra ID (formerly Azure AD) authentication when connecting to your
Azure Database for PostgreSQL instances, and,
1. DiskANN indexing algorithm when indexing your (semantic) vectors.
This way, you can leverage your Azure Database for PostgreSQL instances as secure
and fast vector stores for your LangChain workflows.
> [!NOTE]
> `langchain-azure-postgresql` currently supports Python 3.10 and above.
## Installation
To install `langchain-azure-postgresql`, you need to install the necessary Python
packages:
```cmd
$ python3 -m pip install langchain langchain-azure-postgresql langchain-openai
# logs stripped for brevity
```
## Usage
Once the packages are installed, you can use Azure Database for PostgreSQL instances
as vector stores:
```python
import os
from langchain_core.documents import Document
from langchain_openai import OpenAIEmbeddings
from langchain_azure_postgresql.common import AzurePGConnectionPool, ConnectionInfo
from langchain_azure_postgresql.langchain import AzurePGVectorStore
documents = [
Document(
page_content="Dogs are great companions, known for their loyalty and friendliness.",
metadata={"source": "mammal-pets-doc"},
),
Document(
page_content="Cats are independent pets that often enjoy their own space.",
metadata={"source": "mammal-pets-doc"},
),
]
host = os.getenv("PGHOST", "localhost")
connection_pool = AzurePGConnectionPool(azure_conn_info=ConnectionInfo(host=host))
embedding = OpenAIEmbeddings(model="text-embedding-3-small")
vector_store = AzurePGVectorStore(connection_pool=connection_pool, embedding=embedding)
vector_store.add_documents(documents)
```
The code snippet above will try to connect to your PostgreSQL `host`, as defined
by the environment variable `PGHOST`, and fall back to connecting to `localhost`
if the environment variable is not defined. By default, `ConnectionInfo` objects
try to use Microsoft Entra ID to login to the PostgreSQL instances/hosts.
Please see the documentation for more details on configuring various classes
provided by `langchain-azure-postgresql`.
## Development
The development environment for this package is managed by [`uv`][uv-link], an
up-and-coming and versatile Python package and project manager.
To create the development environment, you first need to install `uv` in your
development environment (unless you are using the development container setup
as provided by this repository). Once `uv` is properly installed and set up,
you can run the following commands to synchronize and activate the development
environment:
```cmd
$ uv sync --all-extras # synchronize the development environment from uv.lock
# logs stripped for brevity
$ source .venv/bin/activate # or, as appropriate for your shell, e.g., fish
```
Once the development environment is synchronized and activated, you can start
contributing changes to the package. For test automation, the package leverages
[`tox`][tox-link], a test automation and standardization framework in Python.
There are some pre-defined test environments and labels managed by `tox`:
```cmd
$ tox list
default environments:
lint -> Run lint checks on the code base
package -> Run packaging checks on the code base
type -> Run type checks on the code base
3.10 -> Run tests under Python 3.10
3.11 -> Run tests under Python 3.11
3.12 -> Run tests under Python 3.12
3.13 -> Run tests under Python 3.13
```
The default environments are for running lint checks, packaging checks, type
checks, and end-to-end tests for different Python versions, respectively. You
can selectively run an environment via, e.g., `tox run -e lint`, or, otherwise,
run the full suite of tests via `tox`. There is a special label called `test`,
which will run _only_ the end-to-end tests for all the supported Python versions
and can be run via the following:
```cmd
$ PGHOST=<host>.postgres.database.azure.com PGPASSWORD='your_password' tox run -m test
# logs stripped for brevity
```
For more information on the supported test flags and environment variables, please
check the output of `pytest --help`.
[uv-link]: https://docs.astral.sh/uv/
[tox-link]: https://tox.wiki/
Raw data
{
"_id": null,
"home_page": null,
"name": "langchain-azure-postgresql",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.10",
"maintainer_email": "Arda Aytekin <8845951+aytekinar@users.noreply.github.com>, Orhan Kislal <kislalorhan@microsoft.com>",
"keywords": "azure, database, langchain, postgresql, vectorstore",
"author": null,
"author_email": "Arda Aytekin <8845951+aytekinar@users.noreply.github.com>",
"download_url": "https://files.pythonhosted.org/packages/bc/ef/2f2c207e6099467cc572f01ac4070c57c2b9a9425f66efb5fe4a78143c23/langchain_azure_postgresql-0.1.0.tar.gz",
"platform": null,
"description": "# langchain-azure-postgresql\n\n`langchain-azure-postgresql` is a Python package that implements both asynchronous\nand synchronous `VectorStore` support for Azure Database for PostgreSQL. Specifically,\nthis package adds support for\n\n1. Microsoft Entra ID (formerly Azure AD) authentication when connecting to your\n Azure Database for PostgreSQL instances, and,\n1. DiskANN indexing algorithm when indexing your (semantic) vectors.\n\nThis way, you can leverage your Azure Database for PostgreSQL instances as secure\nand fast vector stores for your LangChain workflows.\n\n> [!NOTE]\n> `langchain-azure-postgresql` currently supports Python 3.10 and above.\n\n## Installation\n\nTo install `langchain-azure-postgresql`, you need to install the necessary Python\npackages:\n\n```cmd\n$ python3 -m pip install langchain langchain-azure-postgresql langchain-openai\n# logs stripped for brevity\n```\n\n## Usage\n\nOnce the packages are installed, you can use Azure Database for PostgreSQL instances\nas vector stores:\n\n```python\nimport os\n\nfrom langchain_core.documents import Document\nfrom langchain_openai import OpenAIEmbeddings\n\nfrom langchain_azure_postgresql.common import AzurePGConnectionPool, ConnectionInfo\nfrom langchain_azure_postgresql.langchain import AzurePGVectorStore\n\ndocuments = [\n Document(\n page_content=\"Dogs are great companions, known for their loyalty and friendliness.\",\n metadata={\"source\": \"mammal-pets-doc\"},\n ),\n Document(\n page_content=\"Cats are independent pets that often enjoy their own space.\",\n metadata={\"source\": \"mammal-pets-doc\"},\n ),\n]\n\nhost = os.getenv(\"PGHOST\", \"localhost\")\nconnection_pool = AzurePGConnectionPool(azure_conn_info=ConnectionInfo(host=host))\n\nembedding = OpenAIEmbeddings(model=\"text-embedding-3-small\")\n\nvector_store = AzurePGVectorStore(connection_pool=connection_pool, embedding=embedding)\n\nvector_store.add_documents(documents)\n```\n\nThe code snippet above will try to connect to your PostgreSQL `host`, as defined\nby the environment variable `PGHOST`, and fall back to connecting to `localhost`\nif the environment variable is not defined. By default, `ConnectionInfo` objects\ntry to use Microsoft Entra ID to login to the PostgreSQL instances/hosts.\n\nPlease see the documentation for more details on configuring various classes\nprovided by `langchain-azure-postgresql`.\n\n## Development\n\nThe development environment for this package is managed by [`uv`][uv-link], an\nup-and-coming and versatile Python package and project manager.\n\nTo create the development environment, you first need to install `uv` in your\ndevelopment environment (unless you are using the development container setup\nas provided by this repository). Once `uv` is properly installed and set up,\nyou can run the following commands to synchronize and activate the development\nenvironment:\n\n```cmd\n$ uv sync --all-extras # synchronize the development environment from uv.lock\n# logs stripped for brevity\n$ source .venv/bin/activate # or, as appropriate for your shell, e.g., fish\n```\n\nOnce the development environment is synchronized and activated, you can start\ncontributing changes to the package. For test automation, the package leverages\n[`tox`][tox-link], a test automation and standardization framework in Python.\n\nThere are some pre-defined test environments and labels managed by `tox`:\n\n```cmd\n$ tox list\ndefault environments:\nlint -> Run lint checks on the code base\npackage -> Run packaging checks on the code base\ntype -> Run type checks on the code base\n3.10 -> Run tests under Python 3.10\n3.11 -> Run tests under Python 3.11\n3.12 -> Run tests under Python 3.12\n3.13 -> Run tests under Python 3.13\n```\n\nThe default environments are for running lint checks, packaging checks, type\nchecks, and end-to-end tests for different Python versions, respectively. You\ncan selectively run an environment via, e.g., `tox run -e lint`, or, otherwise,\nrun the full suite of tests via `tox`. There is a special label called `test`,\nwhich will run _only_ the end-to-end tests for all the supported Python versions\nand can be run via the following:\n\n```cmd\n$ PGHOST=<host>.postgres.database.azure.com PGPASSWORD='your_password' tox run -m test\n# logs stripped for brevity\n```\n\nFor more information on the supported test flags and environment variables, please\ncheck the output of `pytest --help`.\n\n[uv-link]: https://docs.astral.sh/uv/\n[tox-link]: https://tox.wiki/\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Microsoft Corporation\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "LangChain VectorStore integrations for Azure Database for PostgreSQL",
"version": "0.1.0",
"project_urls": {
"Release Notes": "https://github.com/langchain-ai/langchain-azure/releases",
"Source Code": "https://github.com/langchain-ai/langchain-azure/tree/main/libs/azure-postgresql",
"repository": "https://github.com/langchain-ai/langchain-azure"
},
"split_keywords": [
"azure",
" database",
" langchain",
" postgresql",
" vectorstore"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e1b938a9c1609ba1afbf56b1dbcf1d499a8f25a5654c5ca82158fa6e0a56aea4",
"md5": "8c83db7853bf30fa3225cd006a60448a",
"sha256": "afbe86e75fd80fb7c72ecdb556ef1f2c75c7be44f65debaf2c839319fe8c92b6"
},
"downloads": -1,
"filename": "langchain_azure_postgresql-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8c83db7853bf30fa3225cd006a60448a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.10",
"size": 31791,
"upload_time": "2025-08-15T07:50:15",
"upload_time_iso_8601": "2025-08-15T07:50:15.595740Z",
"url": "https://files.pythonhosted.org/packages/e1/b9/38a9c1609ba1afbf56b1dbcf1d499a8f25a5654c5ca82158fa6e0a56aea4/langchain_azure_postgresql-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bcef2f2c207e6099467cc572f01ac4070c57c2b9a9425f66efb5fe4a78143c23",
"md5": "d210dade7384cb069482f559852b604d",
"sha256": "77ca08561732147a9f777ef9ae57c6756c901b9bf4ebdd77dd07716473e610ef"
},
"downloads": -1,
"filename": "langchain_azure_postgresql-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d210dade7384cb069482f559852b604d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.10",
"size": 28243,
"upload_time": "2025-08-15T07:50:16",
"upload_time_iso_8601": "2025-08-15T07:50:16.929598Z",
"url": "https://files.pythonhosted.org/packages/bc/ef/2f2c207e6099467cc572f01ac4070c57c2b9a9425f66efb5fe4a78143c23/langchain_azure_postgresql-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-15 07:50:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "langchain-ai",
"github_project": "langchain-azure",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "langchain-azure-postgresql"
}