Migrate
Migrate from Pinecone to Lantern Cloud
This guide assumes that you are using Pinecone, and that you want to use Lantern Cloud instead.
Steps
-
Create a Lantern Cloud database
Sign up for Lantern Cloud and create a database. Obtain a database URL. We'll call this
LANTERN_DATABASE_URL. -
Install the
lantern-pineconeclientThe most straightforward way to migrate from Pinecone to Lantern Cloud is by using the
lantern-pineconePython client. Even if you don't want to uselantern-pineconeas your primary data client, you can use it to migrate the data and then interact with your data using another data client.bashCopypip install lantern-pinecone -
Initialize client and migrate
Next, we will initialize the Lantern client.
pythonCopyimport lantern_pinecone LANTERN_DATABASE_URL = "<your_lantern_database_url>" lantern_pinecone.init(LANTERN_DATABASE_URL)For optimal performance, provide a list of
pinecone_idsto the client. Otherwise, the client will use a workaround to query the Pinecone API to retrieve the IDs. For more details, see [1] [2].In the example below, we assume that the Pinecone has vectors with sequential ids from 0 to 1000.
pythonCopypinecone_ids = list(map(lambda x: str(x), range(1000))) index = lantern_pinecone.create_from_pinecone( api_key=<your_pinecone_api_key>, environment=<your_pinecone_environment>, index_name=<pinecone_index_name>, pinecone_ids=pinecone_ids, )See the documentation for more details on the
lantern-pineconeclient. -
Final steps
After this step the data will be copied to your database under a table with the same name as your
<pinecone_index_name>withHNSWindex onembeddingcolumn andGINindex on themetadatacolumnYou can view index stats using
pythonCopyindex.describe_index_stats()
Support
To read more about the lantern-pinecone client, check out the Github repo.
Reach out to support@lantern.dev for any questions or assistance with migrations. We're happy to help.