Introduction
With a single line of Cursor, develop a LangGraph program that can interact with any database, regardless of its structure!
Preparation
-
Download a copy of the LangGraph code, remember the location, and update to .cursorrules -
Prepare a .cursorrules file to store the following content -
Download the DB file and reference file main.py I provided, and place them in the root directory of the project -
Set up a conda virtual environment
The directory structure is as follows
LangGraph-SQL4/├── main.py # Reference file├── Chinook.db # Test database└── .cursorrules # Cursor IDE configuration file
Content of the .cursorrules file :
langgraph's code in /xxx/github/langgraph using conda langgraph environment when using openai, model='deepseek-chat', base_url="https://api.deepseek.com", key=sk-xxxxpip install, default using https://pypi.tuna.tsinghua.edu.cn/simple
One Line to Get It Done
Prompt:
Develop a Python program based on LangChain, using SQLDatabaseToolkit to access SQLite (Chinook.db), achieving natural language query interaction in command-line mode. Refer to @main.py using conda langgraph environment
Cursor Works Automatically:
-
Automatically create and enter the virtual environment -
Automatically install dependencies -
Automatically transform -
Automatically fix errors
Done!
File link: https://749ju.notion.site/LangGraph-1-DB-16f2cce1260e80eb826cd45e44f52800?pvs=4
If you’ve read this far, join the group chat about Cursor. WeChat ID: puppy521
