Skip to content

fix: Use dollar-quoted literals for JSON parameters in Snowflake Cortex SQL #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewli1030
Copy link

Summary

Updates the SQL statement in ChatSnowflakeCortex to use Snowflake's dollar-quoted string literals ($$) instead of single quotes for JSON parameters. This prevents potential escaping issues when JSON contains single quotes or other special characters.

Why

Using dollar-quoted literals is the recommended approach in Snowflake for JSON strings as it:

  • Eliminates the need to escape single quotes within JSON
  • Reduces the risk of SQL injection vulnerabilities
  • Improves readability and maintainability
  • Follows Snowflake best practices for handling JSON data

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