forked from Archives/langchain
fixes to docs (#5919)
This commit is contained in:
parent
7cc200766e
commit
7af186fddf
@ -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/discord_loader.ipynb
|
||||||
./document_loaders/examples/docugami.ipynb
|
./document_loaders/examples/docugami.ipynb
|
||||||
./document_loaders/examples/duckdb.ipynb
|
./document_loaders/examples/duckdb.ipynb
|
||||||
|
./document_loaders/examples/fauna.ipynb
|
||||||
./document_loaders/examples/figma.ipynb
|
./document_loaders/examples/figma.ipynb
|
||||||
./document_loaders/examples/gitbook.ipynb
|
./document_loaders/examples/gitbook.ipynb
|
||||||
./document_loaders/examples/git.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/reddit.ipynb
|
||||||
./document_loaders/examples/roam.ipynb
|
./document_loaders/examples/roam.ipynb
|
||||||
./document_loaders/examples/slack.ipynb
|
./document_loaders/examples/slack.ipynb
|
||||||
|
./document_loaders/examples/snowflake.ipynb
|
||||||
./document_loaders/examples/spreedly.ipynb
|
./document_loaders/examples/spreedly.ipynb
|
||||||
./document_loaders/examples/stripe.ipynb
|
./document_loaders/examples/stripe.ipynb
|
||||||
./document_loaders/examples/tomarkdown.ipynb
|
./document_loaders/examples/tomarkdown.ipynb
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# Snowflake\n",
|
||||||
|
"\n",
|
||||||
|
"This notebooks goes over how to load documents from Snowflake"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@ -16,7 +25,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import settings as s\n",
|
"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",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.16"
|
"version": "3.9.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
@ -90,6 +90,7 @@ from langchain.document_loaders.s3_directory import S3DirectoryLoader
|
|||||||
from langchain.document_loaders.s3_file import S3FileLoader
|
from langchain.document_loaders.s3_file import S3FileLoader
|
||||||
from langchain.document_loaders.sitemap import SitemapLoader
|
from langchain.document_loaders.sitemap import SitemapLoader
|
||||||
from langchain.document_loaders.slack_directory import SlackDirectoryLoader
|
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.spreedly import SpreedlyLoader
|
||||||
from langchain.document_loaders.srt import SRTLoader
|
from langchain.document_loaders.srt import SRTLoader
|
||||||
from langchain.document_loaders.stripe import StripeLoader
|
from langchain.document_loaders.stripe import StripeLoader
|
||||||
@ -244,4 +245,5 @@ __all__ = [
|
|||||||
"WhatsAppChatLoader",
|
"WhatsAppChatLoader",
|
||||||
"WikipediaLoader",
|
"WikipediaLoader",
|
||||||
"YoutubeLoader",
|
"YoutubeLoader",
|
||||||
|
"SnowflakeLoader",
|
||||||
]
|
]
|
||||||
|
@ -2,8 +2,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Dict, Iterator, List, Optional, Tuple
|
from typing import Any, Dict, Iterator, List, Optional, Tuple
|
||||||
|
|
||||||
from snowflake.connector import DictCursor
|
|
||||||
|
|
||||||
from langchain.docstore.document import Document
|
from langchain.docstore.document import Document
|
||||||
from langchain.document_loaders.base import BaseLoader
|
from langchain.document_loaders.base import BaseLoader
|
||||||
|
|
||||||
@ -61,6 +59,7 @@ class SnowflakeLoader(BaseLoader):
|
|||||||
def _execute_query(self) -> List[Dict[str, Any]]:
|
def _execute_query(self) -> List[Dict[str, Any]]:
|
||||||
try:
|
try:
|
||||||
import snowflake.connector
|
import snowflake.connector
|
||||||
|
from snowflake.connector import DictCursor
|
||||||
except ImportError as ex:
|
except ImportError as ex:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Could not import snowflake-connector-python package. "
|
"Could not import snowflake-connector-python package. "
|
||||||
@ -77,7 +76,6 @@ class SnowflakeLoader(BaseLoader):
|
|||||||
schema=self.schema,
|
schema=self.schema,
|
||||||
parameters=self.parameters,
|
parameters=self.parameters,
|
||||||
)
|
)
|
||||||
query_result = []
|
|
||||||
try:
|
try:
|
||||||
cur = conn.cursor(DictCursor)
|
cur = conn.cursor(DictCursor)
|
||||||
cur.execute("USE DATABASE " + self.database)
|
cur.execute("USE DATABASE " + self.database)
|
||||||
|
Loading…
Reference in New Issue
Block a user