Migrate data from a vector database to AlloyDBStay organized with collectionsSave and categorize content based on your preferences.
This tutorial describes how to migrate data from a third-party vector database
to AlloyDB for PostgreSQL using aLangChainVectorStore.
This tutorial assumes that the data in third-party vector databases was created
using a LangChain VectorStore integration. If you put information into one of
the following databases without using LangChain, you might need to edit the
below provided scripts to match your data's schema.
The following vector databases are supported:
To generate a cost estimate based on your projected usage,
use thepricing calculator.
New Google Cloud users might be eligible for afree trial.
When you finish the tasks that are described in this document, you can avoid
continued billing by deleting the resources that you created. For more information, seeClean up.
Before you begin
Make sure that you have one of the following LangChain third-party
database vector stores:
In theConfirm projectstep, clickNextto confirm the name of the project you are going to make changes to.
In theEnable APIsstep, clickEnableto enable the following:
AlloyDB API
Compute Engine API
Service Networking API
Required roles
To get the permissions that you need to complete the tasks in this tutorial,
have the following Identity and Access Management (IAM) roles which allow for table
creation and data insertion:
Owner (roles/owner) or Editor (roles/editor)
If the user is not an owner or editor, the following IAM roles
and PostgreSQL privileges are required:
The VectorStore interface requires an embedding service. This workflow doesn't
generate new embeddings, so theFakeEmbeddingsclass is used to avoid any
costs.
This code adds additional vector embedding metadata to thelangchain_metadatacolumn in a JSON format.
To make filtering more efficient, organize this metadata into separate columns.
For more information, seeCreate a custom Vector Store.
To initialize a vector store object, run the following command:
To avoid incurring charges to your Google Cloud account for the resources used in this
tutorial, either delete the project that contains the resources, or keep the project and
delete the individual resources.
In the Google Cloud console, go to theClusterspage.
[[["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 2026-06-10 UTC."],[],[]]