TiDBLoader#
- class langchain_community.document_loaders.tidb.TiDBLoader(connection_string: str, query: str, page_content_columns: List[str] | None = None, metadata_columns: List[str] | None = None, engine_args: Dict[str, Any] | None = None)[source]#
Load documents from TiDB.
Initialize TiDB document loader.
- Parameters:
connection_string (str) β The connection string for the TiDB database, format: βmysql+pymysql://root@127.0.0.1:4000/testβ.
query (str) β The query to run in TiDB.
page_content_columns (List[str] | None) β Optional. Columns written to Document page_content, default(None) to all columns.
metadata_columns (List[str] | None) β Optional. Columns written to Document metadata, default(None) to no columns.
engine_args (Dict[str, Any] | None) β Optional. Additional arguments to pass to sqlalchemy engine.
Methods
__init__
(connection_string,Β query[,Β ...])Initialize TiDB document loader.
A lazy loader for Documents.
aload
()Load data into Document objects.
Lazy load TiDB data into document objects.
load
()Load data into Document objects.
load_and_split
([text_splitter])Load Documents and split into chunks.
- __init__(connection_string: str, query: str, page_content_columns: List[str] | None = None, metadata_columns: List[str] | None = None, engine_args: Dict[str, Any] | None = None) None [source]#
Initialize TiDB document loader.
- Parameters:
connection_string (str) β The connection string for the TiDB database, format: βmysql+pymysql://root@127.0.0.1:4000/testβ.
query (str) β The query to run in TiDB.
page_content_columns (List[str] | None) β Optional. Columns written to Document page_content, default(None) to all columns.
metadata_columns (List[str] | None) β Optional. Columns written to Document metadata, default(None) to no columns.
engine_args (Dict[str, Any] | None) β Optional. Additional arguments to pass to sqlalchemy engine.
- Return type:
None
- async alazy_load() AsyncIterator[Document] #
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
- lazy_load() Iterator[Document] [source]#
Lazy load TiDB data into document objects.
- Return type:
Iterator[Document]
- load_and_split(text_splitter: TextSplitter | None = None) List[Document] #
Load Documents and split into chunks. Chunks are returned as Documents.
Do not override this method. It should be considered to be deprecated!
- Parameters:
text_splitter (Optional[TextSplitter]) β TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.
- Returns:
List of Documents.
- Return type:
List[Document]
Examples using TiDBLoader