Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zainhoda committed Jul 21, 2023
1 parent 2a49770 commit a10015e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 18 deletions.
6 changes: 6 additions & 0 deletions docs/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ vn.run_sql = run_sql_postgres

## **Snowflake**

We have a built-in function for Snowflake, so you don't need to write your own.

```python
vn.connect_to_snowflake(account='my-account', username='my-username', password='my-password', database='my-database')
```

```python
import pandas as pd
from snowflake.connector.pandas_tools import pd_read_sql
Expand Down
2 changes: 1 addition & 1 deletion docs/intro-to-vanna.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Intro to Vanna: A Python-based AI SQL co-pilot

**TLDR**: We help data people that know Python write SQL faster using AI. [See our starter notebook here](https://github.com/vanna-ai/vanna-py/blob/main/notebooks/vn-starter.ipynb).
**TLDR**: We help data people that know Python write SQL faster using AI. [See our starter notebook here](notebooks/vn-starter.md).

## The deluge of data

Expand Down
4 changes: 2 additions & 2 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ marp-pre {
border-radius: 30px;
}

.md-nav__link {
/* .md-nav__link {
font-size: 0.9rem;
}
} */

h2.doc-heading {
border-top: 1px solid rgb(217, 217, 217);
Expand Down
22 changes: 14 additions & 8 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
site_name: Vanna.AI Documentation
nav:
- What is Vanna.AI?: index.md
- Intro to Vanna: intro-to-vanna.md
- Use with Streamlit: streamlit.md
- Intro:
- What is Vanna.AI?: index.md
- Intro to Vanna: intro-to-vanna.md
- How Vanna Works:
- Onboarding: onboarding.md
- Adding Vanna to your Workflow: workflow.md
- Use in Notebooks:
- Getting Started: notebooks/vn-starter.md
- Training Vanna: notebooks/vn-training.md
- Full Functionality: notebooks/vn-full.md
- Use with your Database: databases.md
- Onboarding: onboarding.md
- Code to Get Started: notebooks/vn-starter.md
- Adding Vanna to your Workflow: workflow.md
- Code Reference: reference.md
- Other Ways to Use Vanna:
- Use with Streamlit: streamlit.md
- Databases:
- Use with your Database: databases.md
- Advanced:
- Code Reference: reference.md
- Support: support.md
repo_url: https://github.com/vanna-ai/vanna-py
theme:
Expand All @@ -22,6 +26,8 @@ theme:
name: material
palette:
scheme: slate
features:
- navigation.sections
extra_css:
- stylesheets/extra.css
extra:
Expand Down
32 changes: 25 additions & 7 deletions src/vanna/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
r'''
# What is Vanna.AI?
Vanna.AI is a platform that allows you to ask questions about your data in plain English. It is an AI-powered data analyst that can answer questions about your data, generate SQL, and create visualizations.
# Basic Usage
## Getting an API key
```python
import vanna as vn
api_key = vn.get_api_key('[email protected]')
vn.set_api_key(api_key)
```
## Setting the dataset
```python
vn.set_dataset('demo-tpc-h')
```
## Asking a question
```python
sql, df, fig = vn.ask(question='What are the top 10 customers by sales?')
```
For a more comprehensive starting guide see the [Starter Notebook](/notebooks/vn-starter/).
# Nomenclature
| Prefix | Definition | Examples |
| --- | --- | --- |
| `vn.set_` | Sets the variable for the current session | [`vn.set_dataset(...)`][vanna.set_dataset] <br> [`vn.set_api_key(...)`][vanna.set_api_key] |
| `vn.get_` | Performs a read-only operation | [`vn.get_dataset()`][vanna.get_datasets] |
| `vn.add_` | Adds something to the dataset | |
| `vn.add_` | Adds something to the dataset | [`vn.add_sql(...)`][vanna.add_sql] <br> [`vn.add_ddl(...)`][vanna.add_ddl] |
| `vn.generate_` | Generates something using AI based on the information in the dataset | [`vn.generate_sql(...)`][vanna.generate_sql] <br> [`vn.generate_explanation()`][vanna.generate_explanation] |
| `vn.run_` | Runs code (SQL or Plotly) | [`vn.run_sql`][vanna.run_sql] |
| `vn.remove_` | Removes something from the dataset | |
| `vn.update_` | Updates something in the dataset | |
| `vn.remove_` | Removes something from the dataset | [`vn.remove_sql`][vanna.remove_sql] |
| `vn.update_` | Updates something in the dataset | [`vn.update_dataset_visibility(...)`][vanna.update_dataset_visibility] |
| `vn.connect_` | Connects to a database | [`vn.connect_to_snowflake(...)`][vanna.connect_to_snowflake] |
# API Reference
Expand Down Expand Up @@ -256,11 +274,11 @@ def add_user_to_dataset(dataset: str, email: str, is_admin: bool) -> bool:

return status.success

def set_dataset_visibility(public: bool) -> bool:
def update_dataset_visibility(public: bool) -> bool:
"""
**Example:**
```python
vn.set_dataset_visibility(public=True)
vn.update_dataset_visibility(public=True)
```
Set the visibility of the current dataset. If a dataset is visible, anyone can see it. If it is not visible, only members of the dataset can see it.
Expand Down

0 comments on commit a10015e

Please sign in to comment.