Copilot Tools
What are Copilot Tools?
Copilot Tools in DBCode allow you to interact with your databases using simple natural language. Instead of writing complex SQL queries or remembering connection details, you can simply ask questions about your data and get immediate results.
With DBCode’s Copilot Tools integration, you can:
- Find connections - Copilot can discover your available database connections automatically
- Read database schemas - Ask about tables, columns, and relationships without memorizing your schema
- Execute queries - Ask questions about your data in plain English and get SQL executed for you
- Interpret results - Get insights and explanations of query results in natural language
Get Started
Simply use the agent mode in Copilot to enable the tools in your Copilot chat window. Once activated, you can start asking questions about your data in natural language.
Working with Schema Context
Copilot doesn’t automatically know your database structure. To generate accurate queries, you need to first ask it to read your schema, then ask it to write queries using that information.
Two-Step Workflow
-
First, ask Copilot to read your schema:
- “What tables are in the sales_db database on my PostgreSQL connection?”
- “Show me all tables and columns from my_database on the MySQL Dev connection”
-
Then, ask questions using that context:
- “Now find all records created in the last week”
- “Write a query to calculate the total revenue by region”
- “Show me the top 10 most active users”
Why This Matters
Without reading the schema first, Copilot will guess table and column names based on common patterns, which often don’t match your actual database structure. By explicitly asking it to read your schema first, you ensure accurate queries using your real table and column names.
Example Prompts
Here are some examples of what you can ask:
Schema exploration:
- “What tables exist in the sales_db database on my PostgreSQL connection?”
- “Show me the schema of the users table in the sales_db database on my MariaDB Dev connection”
- “List all tables and their columns from my_database on my SQL Server connection”
Queries with context:
- “First read the schema from sales_db on my PostgreSQL connection, then find all records created in the last 30 days”
- “What tables are in my database? Then calculate the total count grouped by status”
- “Read the schema, then show me the top 10 items by revenue”
- “Get the table structure first, then write a query to find inactive accounts”
Connection management:
- “Find connections to my PostgreSQL database”
- “What databases are available on my MySQL connection?”