SQL
Writing and executing SQL queries with DB Lens is easy and intuitive. You can write and execute queries directly in the SQL editor, and view the results in a tabular/JSON format of your choice.
Executing Queries
To execute a query, simply write your query in the SQL editor and click on the
Run
button. The results will be displayed tab below the SQL editor.
Tip: You can also use
Ctrl + Enter
orCmd + Enter
to execute the query for quick access.
AI Fixes
DB Lens uses AI to provide you with suggestions and fixes for your queries. You
can view the suggestions by clicking on the Get AI Suggestion 🪄
button.
AI Fixes are currently generated with OpenAI, and are in beta, to enable this, you need to have an OpenAI API key set in your command execution environment.
export OPENAI_API_KEY=<your-openai-api-key> npx dblens <your-db-connection-string>
By enabling this, you agree to the OpenAI API terms of service and your errored query, Error response, and DB schema will be used to generate the suggestions.
Toggle between Tabular and JSON View
You can toggle between the tabular and JSON view of the query results by
clicking on the 📄
and {}
buttons respectively.
Exporting Results
Copy to Clipboard
You can copy the query results to the clipboard by clicking on the 📋
button.
Export to CSV
Coming soon...