-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SnowFlake): snowflake connector (#574)
* Add Basic code for SnowFlake Connector * feat[Snowflake]: Adding SnowFlake Connector * fix: missing , in where clause of example * test: snowflake parser improvements * fix: Yahoo connector * fix: ruff issues * fix: example of yahoo finance * Adding test cases for snowflake * fix doc string
- Loading branch information
1 parent
5464a4d
commit 58559db
Showing
10 changed files
with
329 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Example of using PandasAI with a Snowflake""" | ||
|
||
from pandasai import SmartDataframe | ||
from pandasai.llm import OpenAI | ||
from pandasai.connectors import SnowFlakeConnector | ||
|
||
|
||
snowflake_connector = SnowFlakeConnector( | ||
config={ | ||
"account": "ehxzojy-ue47135", | ||
"database": "SNOWFLAKE_SAMPLE_DATA", | ||
"username": "test", | ||
"password": "*****", | ||
"table": "lineitem", | ||
"warehouse": "COMPUTE_WH", | ||
"dbSchema": "tpch_sf1", | ||
"where": [ | ||
# this is optional and filters the data to | ||
# reduce the size of the dataframe | ||
["l_quantity", ">", "49"] | ||
], | ||
} | ||
) | ||
|
||
OPEN_AI_API = "Your-API-Key" | ||
llm = OpenAI(api_token=OPEN_AI_API) | ||
df = SmartDataframe(snowflake_connector, config={"llm": llm}) | ||
|
||
response = df.chat("Count line status is F") | ||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from pandasai.connectors.yahoo_finance import YahooFinanceConnector | ||
from pandasai import SmartDataframe | ||
from pandasai.llm import OpenAI | ||
|
||
|
||
yahoo_connector = YahooFinanceConnector("MSFT") | ||
|
||
|
||
OPEN_AI_API = "OPEN_API_KEY" | ||
llm = OpenAI(api_token=OPEN_AI_API) | ||
df = SmartDataframe(yahoo_connector, config={"llm": llm}) | ||
|
||
response = df.chat("closing price yesterday") | ||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.