Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Saroj Dhiman
/
nlp_to_sql_query_generator
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9bd31ff4
authored
Dec 12, 2023
by
Saroj Dhiman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload new file
1 parent
16dda69d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
vanna_model.py
vanna_model.py
0 → 100644
View file @
9bd31ff
import
pandas
as
pd
import
vanna
as
vn
# Create login and get API key
api_key
=
vn
.
get_api_key
(
'saroj.dhiman@ociustechnologies.com'
)
vn
.
set_api_key
(
api_key
)
# Create models
vn
.
create_model
(
model
=
"data_warehose"
,
db_type
=
"Snowflake"
)
vn
.
create_model
(
model
=
"marketing_db"
,
db_type
=
"Postgres"
)
vn
.
create_model
(
model
=
"marketing_db"
,
db_type
=
"BigQuery"
)
models
=
vn
.
get_models
()
# Set model
vn
.
set_model
(
'chinook'
)
# Connect to database
url
=
"https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite"
vn
.
connect_to_sqlite
(
url
=
url
)
# Check training data
training_data
=
vn
.
get_training_data
()
training_data
vn
.
ask
(
question
=
'What are the top 5 jazz artists by sales?'
)
training_data
=
vn
.
get_training_data
()
training_data
[
'question'
]
.
str
.
contains
(
'What are the top 5 jazz artists by sales?'
)
.
any
()
vn
.
ask
(
question
=
'Who is the oldest employee'
)
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment