fixes to docs (#5919)

This commit is contained in:
Harrison Chase 2023-06-09 09:15:53 -07:00 committed by GitHub
parent 7cc200766e
commit 7af186fddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5 deletions

View File

@ -116,6 +116,7 @@ We need access tokens and sometime other parameters to get access to these datas
./document_loaders/examples/discord_loader.ipynb
./document_loaders/examples/docugami.ipynb
./document_loaders/examples/duckdb.ipynb
./document_loaders/examples/fauna.ipynb
./document_loaders/examples/figma.ipynb
./document_loaders/examples/gitbook.ipynb
./document_loaders/examples/git.ipynb
@ -137,6 +138,7 @@ We need access tokens and sometime other parameters to get access to these datas
./document_loaders/examples/reddit.ipynb
./document_loaders/examples/roam.ipynb
./document_loaders/examples/slack.ipynb
./document_loaders/examples/snowflake.ipynb
./document_loaders/examples/spreedly.ipynb
./document_loaders/examples/stripe.ipynb
./document_loaders/examples/tomarkdown.ipynb

View File

@ -1,5 +1,14 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Snowflake\n",
"\n",
"This notebooks goes over how to load documents from Snowflake"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -16,7 +25,7 @@
"outputs": [],
"source": [
"import settings as s\n",
"from langchain.document_loaders.snowflake_loader import SnowflakeLoader"
"from langchain.document_loaders import SnowflakeLoader"
]
},
{
@ -81,7 +90,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.9.1"
}
},
"nbformat": 4,

View File

@ -90,6 +90,7 @@ from langchain.document_loaders.s3_directory import S3DirectoryLoader
from langchain.document_loaders.s3_file import S3FileLoader
from langchain.document_loaders.sitemap import SitemapLoader
from langchain.document_loaders.slack_directory import SlackDirectoryLoader
from langchain.document_loaders.snowflake_loader import SnowflakeLoader
from langchain.document_loaders.spreedly import SpreedlyLoader
from langchain.document_loaders.srt import SRTLoader
from langchain.document_loaders.stripe import StripeLoader
@ -244,4 +245,5 @@ __all__ = [
"WhatsAppChatLoader",
"WikipediaLoader",
"YoutubeLoader",
"SnowflakeLoader",
]

View File

@ -2,8 +2,6 @@ from __future__ import annotations
from typing import Any, Dict, Iterator, List, Optional, Tuple
from snowflake.connector import DictCursor
from langchain.docstore.document import Document
from langchain.document_loaders.base import BaseLoader
@ -61,6 +59,7 @@ class SnowflakeLoader(BaseLoader):
def _execute_query(self) -> List[Dict[str, Any]]:
try:
import snowflake.connector
from snowflake.connector import DictCursor
except ImportError as ex:
raise ValueError(
"Could not import snowflake-connector-python package. "
@ -77,7 +76,6 @@ class SnowflakeLoader(BaseLoader):
schema=self.schema,
parameters=self.parameters,
)
query_result = []
try:
cur = conn.cursor(DictCursor)
cur.execute("USE DATABASE " + self.database)