Skip to content

Commit 6c82c4e

Browse files
authored
docs: add docloader codelab (#18)
1 parent 72d160e commit 6c82c4e

File tree

2 files changed

+504
-33
lines changed

2 files changed

+504
-33
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,24 @@ source /bin/activate
3333
<your-env>/bin/pip install langchain-google-cloud-sql-mysql
3434
```
3535

36-
## Usage
36+
## Document Loader Usage
37+
38+
Use a [document loader](https://python.langchain.com/docs/modules/data_connection/document_loaders/) to load data as LangChain `Document`s.
3739

3840
```python
39-
from langchain_google_cloud_sql_mysql import CloudSQLVectorstore, CloudSQLLoader, CloudSQLChatMessageHistory
41+
from langchain_google_cloud_sql_mysql import MySQLEngine, MySQLLoader
42+
43+
44+
engine = MySQLEngine.from_instance("project-id", "region", "my-instance", "my-database")
45+
loader = MySQLLoader(
46+
engine,
47+
table_name="my-table-name"
48+
)
49+
docs = loader.lazy_load()
4050
```
4151

52+
See the full [Document Loader][loader] tutorial.
53+
4254
## Contributing
4355

4456
Contributions to this library are always welcome and highly encouraged.
@@ -61,4 +73,5 @@ This is not an officially supported Google product.
6173
[billing]: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
6274
[api]: https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com
6375
[auth]: https://googleapis.dev/python/google-api-core/latest/auth.html
64-
[venv]: https://virtualenv.pypa.io/en/latest/
76+
[venv]: https://virtualenv.pypa.io/en/latest/
77+
[loader]: ./docs/document_loader.ipynb

0 commit comments

Comments
 (0)