Class MSSQLLoader (0.2.0)

MSSQLLoader(
    engine: langchain_google_cloud_sql_mssql.engine.MSSQLEngine,
    table_name: str = "",
    query: str = "",
    content_columns: typing.Optional[typing.List[str]] = None,
    metadata_columns: typing.Optional[typing.List[str]] = None,
    metadata_json_column: typing.Optional[str] = None,
)

A class for loading langchain documents from a Cloud SQL MSSQL database.

Methods

MSSQLLoader

MSSQLLoader(
    engine: langchain_google_cloud_sql_mssql.engine.MSSQLEngine,
    table_name: str = "",
    query: str = "",
    content_columns: typing.Optional[typing.List[str]] = None,
    metadata_columns: typing.Optional[typing.List[str]] = None,
    metadata_json_column: typing.Optional[str] = None,
)

Document page content defaults to the first column present in the query or table and metadata defaults to all other columns. Use with content_columns to overwrite the column used for page content. Use metadata_columns to select specific metadata columns rather than using all remaining columns.

If multiple content columns are specified, page_content’s string format will default to space-separated string concatenation.

Parameters
Name Description
engine MSSQLEngine

MSSQLEngine object to connect to the MSSQL database.

table_name str

The MSSQL database table name. (OneOf: table_name, query).

query str

The query to execute in MSSQL format. (OneOf: table_name, query).

content_columns List[str]

The columns to write into the page_content of the document. Optional.

metadata_columns List[str]

The columns to write into the metadata of the document. Optional.

metadata_json_column str

The name of the JSON column to use as the metadata’s base dictionary. Default: langchain_metadata. Optional.

lazy_load

lazy_load() -> typing.Iterator[langchain_core.documents.base.Document]

Lazy Load langchain documents from a Cloud SQL MSSQL database. Use lazy load to avoid caching all documents in memory at once.

Returns
Type Description
(Iterator[langchain_core.documents.Document]) a list of Documents with metadata from specific columns.

load

load() -> typing.List[langchain_core.documents.base.Document]

Load langchain documents from a Cloud SQL MSSQL database.

Returns
Type Description
(List[langchain_core.documents.Document]) a list of Documents with metadata from specific columns.