Replies: 2 comments 1 reply
-
Hi! Have you seen the "Other Database" section here? https://vanna.ai/docs/other-database-openai-vanna-vannadb.html import pandas as pd
# There's usually a library for connecting to your type of database. Any SQL database will work here -- you just have to use the right library.
conn_details = {...} # fill this with your connection details
conn = ... # fill this with your connection object
# You define a function that takes in a SQL query as a string and returns a pandas dataframe
def run_sql(sql: str) -> pd.DataFrame:
df = pd.read_sql_query(sql, conn)
return df
# This gives the package a function that it can use to run the SQL
vn.run_sql = run_sql
vn.run_sql_is_set = True |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to connect to MYSQL using vanna? Can you give me a test case?
Beta Was this translation helpful? Give feedback.
All reactions