Skip to content

imporvement(pg): added wand config for writing sql queries for generic db blocks & supabase postgrest syntax#1197

Merged
waleedlatif1 merged 4 commits intostagingfrom
fix/pg
Aug 30, 2025
Merged

imporvement(pg): added wand config for writing sql queries for generic db blocks & supabase postgrest syntax#1197
waleedlatif1 merged 4 commits intostagingfrom
fix/pg

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

added wand config for writing sql queries for generic db blocks & supabase postgrest syntax

Fixes #240

Type of Change

  • Other: Improvement

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 30, 2025 1:30am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 30, 2025 1:30am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds AI-powered SQL query generation capabilities ("wand config") to database blocks across MySQL, PostgreSQL, and Supabase integrations. The primary changes include:

Core Functionality: Added wandConfig properties to database block definitions (mysql.ts, postgresql.ts, supabase.ts) that enable AI-assisted query generation. These configs include comprehensive prompts with SQL syntax examples, best practices, and provider-specific instructions to help users generate queries through natural language descriptions.

UI Integration: Enhanced the ShortInput and Code components to support the new wand functionality, adding streaming content generation, hover-triggered wand buttons, and integration with the WandPromptBar component. The implementation includes proper state management for streaming modes and conversation history maintenance.

Security Improvements: Added WHERE clause validation in both MySQL and PostgreSQL utilities to prevent SQL injection attacks by checking for dangerous patterns like union selects, file operations, and comment-based bypasses. Also standardized SSL defaults from 'preferred' to 'required' across all MySQL tools for enhanced security.

Code Standardization: Replaced global crypto.randomUUID() usage with explicit imports from the Node.js crypto module across all database API routes, following modern ES module best practices and improving code clarity.

The wand config system provides specialized generation types (sql-query, postgrest) with provider-specific prompts that guide the AI to generate syntactically correct queries for each database system. This makes database interactions more accessible to non-SQL experts while maintaining proper security practices.

Confidence score: 3/5

  • This PR introduces significant new functionality with potential for breaking changes and security implications
  • Score reflects concerns about code duplication, breaking API changes, and security validation gaps
  • Pay close attention to the UI component changes and database security validation logic

23 files reviewed, 4 comments

Edit Code Review Bot Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 4310dd6 into staging Aug 30, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/pg branch August 30, 2025 01:32
Sg312 pushed a commit that referenced this pull request Aug 30, 2025
…c db blocks & supabase postgrest syntax (#1197)

* add parallel ai, postgres, mysql, slight modifications to dark mode styling

* bun install frozen lockfile

* new deps

* improve security, add wand to short input and update wand config
waleedlatif1 added a commit that referenced this pull request Sep 1, 2025
…c db blocks & supabase postgrest syntax (#1197)

* add parallel ai, postgres, mysql, slight modifications to dark mode styling

* bun install frozen lockfile

* new deps

* improve security, add wand to short input and update wand config
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…c db blocks & supabase postgrest syntax (simstudioai#1197)

* add parallel ai, postgres, mysql, slight modifications to dark mode styling

* bun install frozen lockfile

* new deps

* improve security, add wand to short input and update wand config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant