AI Chat Assistant
Modifying Data with AI Chat Assistant
Modifying Data with AI Chat Assistant
WhoDB's AI Chat Assistant enables you to modify database records using natural language while maintaining strict safety controls. Every data modification operation requires explicit confirmation before execution, preventing accidental changes to your database.
Warning
Data modification operations are permanent and affect your actual database. Always review confirmation prompts carefully before proceeding.
Note
This workflow requires an active AI provider and selected model. If the Chat input is disabled or no model is available, configure the provider before testing data modifications.
Understanding AI-Powered Data Modification
The AI Chat Assistant translates your natural language instructions into SQL statements for data modifications and schema changes (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP). Unlike read-only queries, these operations follow a confirmation workflow to ensure safety.
Key Safety Features
All data modifications and schema changes (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) require manual confirmation before execution
See exactly what SQL will execute before confirming
Clear confirmation when operations complete successfully
Detailed error messages if modifications fail
How the Confirmation Workflow Works
Info
The confirmation workflow ensures you always know exactly what changes will be made before they occur. The same workflow applies to schema changes (DDL): asking the assistant to CREATE, ALTER, or DROP a table produces the same inline confirmation before anything executes.
INSERT Operations - Adding Records
Use natural language to add new records to your tables. The AI assistant generates appropriate INSERT statements based on your table schema.
text
Create a new product named Laptop with price 999.99, category Electronics, and stock 50
The AI generates:
sql
INSERT INTO products (name, price, category, stock) VALUES ('Laptop', 999.99, 'Electronics', 50)
The inline confirmation appears; click Show Query to verify the table, columns, and values before confirming.
Best Practices for INSERT Operations
UPDATE Operations - Modifying Records
Update existing records by describing what should change and which records to affect.
text
Update the email for user with id 5 to newemail@example.com
The AI generates:
sql
UPDATE users SET email = 'newemail@example.com' WHERE id = 5
Conditional and bulk updates work the same way: "Set all products in Electronics category to have discount 10" generates an UPDATE with the matching WHERE clause.
When the confirmation appears, pay special attention to the WHERE clause.
Warning
Missing WHERE clauses will update ALL records in the table. Always verify the WHERE condition before confirming.
After confirming, verify the "Action Executed" message, then run a follow-up SELECT to confirm the intended records changed.
Best Practices for UPDATE Operations
DELETE Operations - Removing Records
Delete operations require the most caution as they permanently remove data. Like all modifications, DELETE requests go through the inline confirmation before anything executes.
text
Delete user with id 5
The AI generates the statement and shows the inline confirmation:
sql
DELETE FROM users WHERE id = 5
Conditional deletions ("Delete all inactive users", "Remove all log entries older than 90 days") follow the same pattern. Click Show Query to review the DELETE statement and its WHERE clause, then Confirm to execute or Cancel to abort. Afterwards, run a follow-up SELECT to confirm the records are gone.
Warning
DELETE operations are permanent and cannot be undone through WhoDB. Only database backups can restore deleted data.
Best Practices for DELETE Operations
Understanding Confirmation Prompts
The inline confirmation is your final checkpoint before data modification.
What the Confirmation Shows
Checklist Before Confirming
- The SQL targets the intended table and schema
- For UPDATE and DELETE, the WHERE clause targets the correct records
- For INSERT and UPDATE, values are correct and properly formatted
- The number of rows likely affected matches your expectation
- A WHERE clause exists unless you truly intend to affect all records
Tip
If anything in the confirmation looks unexpected, click Cancel and rephrase your request to the AI assistant.
Verifying Modifications
After executing a modification, verify the changes were applied correctly.
Rollback Strategies
Plan recovery before making data modifications.
Prevention is Best
Practice modifications in a development database first
Run critical operations in transaction blocks (via Scratchpad)
Maintain frequent database backups for recovery
Use status flags instead of permanent deletion where possible
If You Make a Mistake
Using Transactions for Safety
For critical modifications, use the Scratchpad to wrap operations in transactions:
sql
BEGIN; UPDATE users SET status = 'inactive' WHERE last_login < '2023-01-01'; -- Review the affected rows SELECT * FROM users WHERE status = 'inactive' AND last_login < '2023-01-01'; -- If everything looks correct: COMMIT; -- If something is wrong: ROLLBACK;
Info
The AI Chat Assistant executes operations immediately after confirmation. For transaction control, use the Scratchpad query interface where you can manually manage BEGIN, COMMIT, and ROLLBACK.
Safety Practices for Production Data
The essentials when modifying production databases:
- Verify your connection — confirm you're on the correct database (production vs. development)
- SELECT before you modify — understand the current state and estimate the affected row count
- Check backups — ensure recent backups exist and have been tested
- Start small — for bulk operations, test with a single record first
- Verify each step — check results after each modification before proceeding
- Schedule bulk operations — perform large modifications during maintenance windows
For the full set of production guidelines, change management checklists, and audit considerations, see AI Chat Assistant Best Practices.
Common Modification Patterns
The core pattern for every safe modification is preview → modify → verify:
The same three-step shape applies to inserts (check the record doesn't exist, insert, confirm it was created), deletions (preview, delete, confirm records are gone), and cleanups. For records with dependencies — such as deleting a user who has orders — handle the related records first, then the parent record.
Troubleshooting
Comparing AI Chat vs. Traditional Methods
Scenario | AI Chat Assistant | Traditional UI | Scratchpad SQL |
|---|---|---|---|
Quick single record change | Fast and convenient | Multiple clicks required | Overkill for simple changes |
Bulk updates with conditions | Natural language, easy | Must use SQL | Most control and visibility |
Complex multi-table operations | May require multiple steps | Not supported | Best option |
Production-critical changes | Good with careful review | Limited capabilities | Recommended for control |
Tip
Use AI Chat for quick modifications and exploration. Use Scratchpad for complex operations requiring transaction control or multiple related statements.
Security Considerations
Warning
Your modification requests and table/column names may be sent to external AI providers. However, actual data values are not sent.
What's Sent to AI Providers: your natural language request, database schema (table and column names), and database type.
What's NOT Sent: actual data values, query results, or existing record contents.
For maximum privacy, use local models (Ollama, LM Studio) for complete data isolation, avoid mentioning sensitive values in your requests, and use Scratchpad for modifications involving sensitive data.
Audit and Compliance: Modifications are associated with the database user credentials used, so database-level logs can attribute changes. Enable your database's audit or query logging for comprehensive tracking.
Permission Management: Follow the principle of least privilege — use database users with only necessary permissions, read-only users for exploration, and separate credentials for production vs. development. See AI Chat Assistant Best Practices for read-only user setup.
Next Steps
Check
Every data modification and schema change (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) requires explicit confirmation, with full visibility into the SQL before it executes. Review carefully, verify with follow-up queries, and maintain backups for recovery.