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
MySQLEngine
MySQLEngine object to connect to the MySQL database.
table_name
str
The MySQL database table name. (OneOf: table_name, query).
query
str
The query to execute in MySQL 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Class MySQLLoader (0.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.3.0 (latest)](/python/docs/reference/langchain-google-cloud-sql-mysql/latest/langchain_google_cloud_sql_mysql.loader.MySQLLoader)\n- [0.2.3](/python/docs/reference/langchain-google-cloud-sql-mysql/0.2.3/langchain_google_cloud_sql_mysql.loader.MySQLLoader) \n\n MySQLLoader(\n engine: langchain_google_cloud_sql_mysql.engine.MySQLEngine,\n table_name: str = \"\",\n query: str = \"\",\n content_columns: typing.Optional[typing.List[str]] = None,\n metadata_columns: typing.Optional[typing.List[str]] = None,\n metadata_json_column: typing.Optional[str] = None,\n )\n\nA class for loading langchain documents from a Cloud SQL MySQL database.\n\nMethods\n-------\n\n### MySQLLoader\n\n MySQLLoader(\n engine: langchain_google_cloud_sql_mysql.engine.MySQLEngine,\n table_name: str = \"\",\n query: str = \"\",\n content_columns: typing.Optional[typing.List[str]] = None,\n metadata_columns: typing.Optional[typing.List[str]] = None,\n metadata_json_column: typing.Optional[str] = None,\n )\n\nDocument page content defaults to the first column present in the query or table and\nmetadata defaults to all other columns. Use with content_columns to overwrite the column\nused for page content. Use metadata_columns to select specific metadata columns rather\nthan using all remaining columns.\n\nIf multiple content columns are specified, page_content's string format will default to\nspace-separated string concatenation.\n\n### lazy_load\n\n lazy_load() -\u003e typing.Iterator[langchain_core.documents.base.Document]\n\nLazy Load langchain documents from a Cloud SQL MySQL database. Use lazy load to avoid\ncaching all documents in memory at once.\n\n### load\n\n load() -\u003e typing.List[langchain_core.documents.base.Document]\n\nLoad langchain documents from a Cloud SQL MySQL database."]]