PostgresLoader
class.
Overview
Before you begin
In order to use this package, you first need to go through the following steps:- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the Cloud SQL Admin API.
- Setup Authentication.
- Create a CloudSQL instance
- Create a CloudSQL database
- Add a user to the database
Authentication
Authenticate locally to your Google Cloud account using thegcloud auth login
command.
Set Your Google Cloud Project
Set your Google Cloud project ID to leverage Google Cloud resources locally:- Run
gcloud config list
. - Run
gcloud projects list
. - See the support page: Locate the project ID.
Setting up a PostgresLoader instance
To use the PostgresLoader class, you’ll need to install the@langchain/google-cloud-sql-pg
package and then follow the steps bellow.
First, you’ll need to log in to your Google Cloud account and set the following environment variables based
on your Google Cloud project; these will be defined based on how you want to configure (fromInstance,
fromEngine, fromEngineArgs) your PostgresEngine instance: