Spaces:
Sleeping
Sleeping
Download db_utils.py from prithvi55/talk2data: direct link, hf CLI and curl.
- Browser
- Download file 305 Bytes
-
https://huggingface.co/spaces/prithvi55/talk2data/resolve/main/db_utils.py
- Command line
-
hf download hf://spaces/prithvi55/talk2data/db_utils.py
-
curl -L -o db_utils.py https://huggingface.co/spaces/prithvi55/talk2data/resolve/main/db_utils.py
305 Bytes
| import pandas as pd | |
| from sqlalchemy import create_engine | |
| from langchain_community.utilities import SQLDatabase | |
| from langchain.chains import LLMChain | |
| def get_engine(db_file="business_data.db"): | |
| return create_engine(f"sqlite:///{db_file}") | |
| def get_db(engine): | |
| return SQLDatabase(engine) | |