Skip to content

Commit

Permalink
link stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
zainhoda committed Aug 2, 2023
1 parent 34f797d commit e4d5368
Show file tree
Hide file tree
Showing 5 changed files with 372 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/sidebar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7a3 3 0 0 1 3-3M5 19h4m0-3c0-4.1 4-4.9 4-9A6 6 0 1 0 1 7c0 4 4 5 4 9h4Z"/>
</svg>
- title: Ask Vanna
link: vn-ask.html
- title: Getting Started
link: getting-started.html
svg_text: |-
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 18">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5h9M5 9h5m8-8H2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h4l3.5 4 3.5-4h5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1Z"/>
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 21 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m8.806 5.614-4.251.362-2.244 2.243a1.058 1.058 0 0 0 .6 1.8l3.036.356m9.439 1.819-.362 4.25-2.243 2.245a1.059 1.059 0 0 1-1.795-.6l-.449-2.983m9.187-12.57a1.536 1.536 0 0 0-1.26-1.26c-1.818-.313-5.52-.7-7.179.96-1.88 1.88-5.863 9.016-7.1 11.275a1.05 1.05 0 0 0 .183 1.25l.932.939.937.936a1.049 1.049 0 0 0 1.25.183c2.259-1.24 9.394-5.222 11.275-7.1 1.66-1.663 1.275-5.365.962-7.183Zm-3.332 4.187a2.115 2.115 0 1 1-4.23 0 2.115 2.115 0 0 1 4.23 0Z"/>
</svg>
- title: Train Vanna
Expand All @@ -19,15 +19,15 @@
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16.5A2.493 2.493 0 0 1 6.51 18H6.5a2.468 2.468 0 0 1-2.4-3.154 2.98 2.98 0 0 1-.85-5.274 2.468 2.468 0 0 1 .921-3.182 2.477 2.477 0 0 1 1.875-3.344 2.5 2.5 0 0 1 3.41-1.856A2.5 2.5 0 0 1 11 3.5m0 13v-13m0 13a2.492 2.492 0 0 0 4.49 1.5h.01a2.467 2.467 0 0 0 2.403-3.154 2.98 2.98 0 0 0 .847-5.274 2.468 2.468 0 0 0-.921-3.182 2.479 2.479 0 0 0-1.875-3.344A2.5 2.5 0 0 0 13.5 1 2.5 2.5 0 0 0 11 3.5m-8 5a2.5 2.5 0 0 1 3.48-2.3m-.28 8.551a3 3 0 0 1-2.953-5.185M19 8.5a2.5 2.5 0 0 0-3.481-2.3m.28 8.551a3 3 0 0 0 2.954-5.185"/>
</svg>
sub_entries:
- title: Train 1
link: /services/train-1
- title: Snowflake
link: vn-train.html
svg_text: |-
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z"/>
</svg>
- title: Train 2
link: /services/train-2
- title: Other Databases
link: manual-train.html
svg_text: |-
<svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z"/>
Expand Down
176 changes: 176 additions & 0 deletions notebooks/databases.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to use Vanna with various databases\n",
"\n",
"You can use Vanna with any database that you can connect to via Python. Here are some examples of how to connect to various databases.\n",
"\n",
"All you have to do is provide Vanna with a function that takes in a SQL query and returns a Pandas DataFrame. Here are some examples of how to do that."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import vanna as vn"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## **PostgreSQL**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import psycopg2\n",
"\n",
"conn_details = {...} # fill this with your connection details\n",
"conn_postgres = psycopg2.connect(**conn_details)\n",
"\n",
"def run_sql_postgres(sql: str) -> pd.DataFrame:\n",
" df = pd.read_sql_query(sql, conn_postgres)\n",
" return df\n",
"\n",
"vn.run_sql = run_sql_postgres"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## **Snowflake**\n",
"\n",
"We have a built-in function for Snowflake, so you don't need to write your own.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vn.connect_to_snowflake(account='my-account', username='my-username', password='my-password', database='my-database')\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## **Google BigQuery**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from google.cloud import bigquery\n",
"import pandas as pd\n",
"\n",
"project_id = 'your-project-id' # replace with your Project ID\n",
"client_bigquery = bigquery.Client(project=project_id)\n",
"\n",
"def run_sql_bigquery(sql: str) -> pd.DataFrame:\n",
" df = client_bigquery.query(sql).to_dataframe()\n",
" return df\n",
"\n",
"vn.run_sql = run_sql_bigquery"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## **Amazon Athena**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from pyathena import connect\n",
"\n",
"conn_details = {...} # fill this with your connection details\n",
"conn_athena = connect(**conn_details)\n",
"\n",
"def run_sql_athena(sql: str) -> pd.DataFrame:\n",
" df = pd.read_sql(sql, conn_athena)\n",
" return df\n",
"\n",
"vn.run_sql = run_sql_athena"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## **Amazon Redshift**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import psycopg2\n",
"\n",
"conn_details = {...} # fill this with your connection details\n",
"conn_redshift = psycopg2.connect(**conn_details)\n",
"\n",
"def run_sql_redshift(sql: str) -> pd.DataFrame:\n",
" df = pd.read_sql_query(sql, conn_redshift)\n",
" return df\n",
"\n",
"vn.run_sql = run_sql_redshift"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# **Others**\n",
"\n",
"You can follow a similar pattern to the others for your database. You just have to provide a `vn.run_sql` function that takes in a SQL query and returns a Pandas DataFrame."
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
128 changes: 128 additions & 0 deletions notebooks/getting-started.ipynb

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions notebooks/manual-train.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Manually Training Vanna"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
34 changes: 34 additions & 0 deletions notebooks/slack.ipynb

Large diffs are not rendered by default.

0 comments on commit e4d5368

Please sign in to comment.