Class AlloyDBLoader
java.lang.Object
dev.langchain4j.community.data.document.loader.alloydb.AlloyDBLoader
AlloyDBLoader
This loader allows you to retrieve data from AlloyDB using either a custom SQL query or a table name. You can specify which columns should be used for the document's content and which for its metadata. Additionally, you can format the content using predefined formats (CSV, text, JSON, YAML) or a custom formatter. Metadata can be loaded from specified columns or from a JSON column.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic AlloyDBLoader.Builderbuilder(AlloyDBEngine engine) Create a newAlloyDBLoader.Builder.List<dev.langchain4j.data.document.Document> load()Executes the configured SQL query against the AlloyDB database and transforms the result set into a list ofDocumentobjects.
-
Method Details
-
load
Executes the configured SQL query against the AlloyDB database and transforms the result set into a list ofDocumentobjects.Each row in the result set is processed according to the configured content columns, metadata columns, and formatter. The content is extracted and formatted, and metadata is assembled from the specified columns or the JSON metadata column.
- Returns:
- A list of
Documentobjects, where each document represents a row from the database result set. - Throws:
SQLException- If a database error occurs during the execution of the query or while processing the result set. This could include issues such as connection problems, SQL syntax errors, or data retrieval failures.RuntimeException- If there's an error parsing the JSON metadata column, indicating an issue with the JSON structure.
-
builder
Create a newAlloyDBLoader.Builder.- Parameters:
engine- The AlloyDB Engine- Returns:
- the new
AlloyDBLoader.Builder.
-