SQL Polyglot ยท emploidai Marketplace
emploidai Marketplace
Add-onsAppletsPlugins
Search tools, teams, and capabilitiesPublish
MarketplacePluginsSQL Polyglot
Plugin
Limited listing

SQL Polyglot

by abesticode ยท v0.0.1

SQL parsing, transpiling, analysis, optimization, and execution across dialects

405 installsUpdated Jan 6, 2026
Publisher information is incomplete

This community listing does not yet include every recommended support, privacy, pricing, and permission disclosure. Review the available package permissions before installing.

Capabilities

Tools

Available inside your emploidai workspace after installation.

Data sources

Available inside your emploidai workspace after installation.

Category

tool

Version

0.0.1abesticode

Requirements

Maximum memory 256MB

Pricing

Not disclosed by publisher

Security & access

Review before installing

CompatibleRequires emploidai 1.0.0+

Permissions

  • Uses tool capability

Dependencies

No additional dependencies

Resources

Privacy policy
emploidai Marketplace

Discover capabilities. Review access. Install inside your workspace.

DocumentationSecuritySupportPrivacyTerms

SQL Polyglot

Author: abesticode
Version: 0.0.1
Type: Tool Plugin

Description

SQL Polyglot is a powerful Dify plugin that provides comprehensive SQL parsing, transpiling, analysis, optimization, and execution capabilities. Built on top of the SQLGlot library, this plugin enables AI agents to work with SQL across 31+ database dialects.

Features

ToolDescription
๐Ÿ”„ SQL Dialect ConverterConvert SQL between 31+ database dialects
๐Ÿ“ SQL BeautifierFormat SQL with proper indentation
๐Ÿ” SQL Metadata ExtractorExtract tables, columns, joins from SQL
โœ… SQL Syntax CheckerValidate SQL syntax and detect errors
โšก SQL Query OptimizerOptimize SQL for better performance
๐Ÿš€ SQL on JSON ExecutorExecute SQL queries on JSON data

Installation

  1. Install the plugin from the Dify Marketplace
  2. No credentials required - SQLGlot runs locally

Usage Examples

๐Ÿ”„ SQL Dialect Converter

Convert SQL from one dialect to another.

Parameters:

  • sql (required): The SQL query to transpile
  • source_dialect (optional): Source dialect (mysql, postgres, bigquery, etc.)
  • target_dialect (required): Target dialect
  • pretty (optional): Format output with indentation (default: true)

Example 1: MySQL to PostgreSQL

Input SQL: SELECT DATE_FORMAT(created_at, '%Y-%m-%d') FROM users
Source Dialect: mysql
Target Dialect: postgres

Output: SELECT TO_CHAR(created_at, 'YYYY-MM-DD') FROM users

Example 2: Spark to BigQuery

Input SQL: SELECT CAST(col AS STRING) FROM table
Source Dialect: spark
Target Dialect: bigquery

Output: SELECT CAST(col AS STRING) FROM table

๐Ÿ“ SQL Beautifier

Beautify SQL with proper indentation and styling.

Parameters:

  • sql (required): The SQL query to format
  • dialect (optional): SQL dialect for parsing
  • identify (optional): Quote all identifiers (default: false)
  • normalize (optional): Normalize identifiers to lowercase (default: false)

Example 1: Basic Formatting

Input SQL: select u.id,u.name,count(o.id) as order_count from users u left join orders o on u.id=o.user_id where u.active=1 group by u.id,u.name order by order_count desc

Output:
SELECT
  u.id,
  u.name,
  COUNT(o.id) AS order_count
FROM users AS u
LEFT JOIN orders AS o
  ON u.id = o.user_id
WHERE
  u.active = 1
GROUP BY
  u.id,
  u.name
ORDER BY
  order_count DESC

Example 2: With Quote Identifiers (identify=true)

Input SQL: SELECT id, name FROM users
identify: true

Output: SELECT "id", "name" FROM "users"

๐Ÿ” SQL Metadata Extractor

Extract metadata from SQL queries.

Parameters:

  • sql (required): The SQL query to analyze
  • dialect (optional): SQL dialect for parsing

Example:

Input SQL: 
SELECT u.name, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.active = 1
GROUP BY u.name
ORDER BY order_count DESC

Output:
{
  "query_type": "Select",
  "tables": [
    {"name": "users", "alias": "u"},
    {"name": "orders", "alias": "o"}
  ],
  "columns": [
    {"name": "name", "table": "u"},
    {"name": "id", "table": "o"},
    {"name": "id", "table": "u"},
    {"name": "user_id", "table": "o"},
    {"name": "active", "table": "u"}
  ],
  "joins": [
    {"type": "LEFT", "table": "orders", "on_condition": "u.id = o.user_id"}
  ],
  "functions": [
    {"name": "Count", "sql": "COUNT(o.id)"}
  ],
  "where_conditions": ["u.active = 1"],
  "group_by": ["u.name"],
  "order_by": [{"expression": "order_count", "desc": true}]
}

โœ… SQL Syntax Checker

Check SQL syntax for errors.

Parameters:

  • sql (required): The SQL query to validate
  • dialect (optional): SQL dialect to validate against

Example 1: Valid SQL

Input SQL: SELECT id, name FROM users WHERE active = 1

Output: โœ“ SQL is valid! Found 1 statement(s).
Statement types: Select

Example 2: Invalid SQL (Missing Parenthesis)

Input SQL: SELECT * FROM users WHERE (id = 1 AND name = 'John'

Output: โœ— SQL Validation Failed: Expecting ). Line 1, Col: 45.
  SELECT * FROM users WHERE (id = 1 AND name = 'John'
                                              ~

Note: Validate SQL checks SYNTAX only (parentheses, keywords, structure), not SEMANTIC (function compatibility with dialect).


โšก SQL Query Optimizer

Optimize SQL queries using various techniques.

Parameters:

  • sql (required): The SQL query to optimize
  • dialect (optional): SQL dialect for parsing
  • schema (optional): JSON object defining table schemas for type-aware optimization

Example 1: Boolean Simplification

Input SQL: SELECT * FROM users WHERE active = TRUE OR active = FALSE

Output: SELECT * FROM users

Example 2: Constant Folding

Input SQL: SELECT * FROM users WHERE created_at > '2024-01-01' + INTERVAL '1' MONTH

Output: SELECT * FROM users WHERE created_at > '2024-02-01'

Example 3: With Schema (Advanced)

Input SQL: 
SELECT A OR (B OR (C AND D))
FROM x
WHERE Z = '2024-01-01' + INTERVAL '1' MONTH OR 1 = 0

Schema: {"x": {"A": "BOOLEAN", "B": "BOOLEAN", "C": "BOOLEAN", "D": "BOOLEAN", "Z": "DATE"}}

Output:
SELECT
  A OR B OR (C AND D)
FROM x
WHERE
  Z = CAST('2024-02-01' AS DATE)

๐Ÿš€ SQL on JSON Executor

Execute SQL queries against JSON data tables.

Parameters:

  • sql (required): The SQL query to execute
  • tables (required): JSON object containing table data
  • dialect (optional): SQL dialect for parsing

Example 1: Simple SELECT

Input SQL: SELECT * FROM users WHERE age > 25

Tables:
{
  "users": [
    {"id": 1, "name": "Alice", "age": 30},
    {"id": 2, "name": "Bob", "age": 22},
    {"id": 3, "name": "Charlie", "age": 28}
  ]
}

Output:
| id | name    | age |
|----|---------|-----|
| 1  | Alice   | 30  |
| 3  | Charlie | 28  |

Example 2: JOIN with Aggregation

Input SQL: 
SELECT u.name, COUNT(o.product) as total_orders, SUM(o.amount) as total_spent
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
GROUP BY u.name

Tables:
{
  "users": [
    {"id": 1, "name": "Alice"},
    {"id": 2, "name": "Bob"},
    {"id": 3, "name": "Charlie"}
  ],
  "orders": [
    {"user_id": 1, "product": "Laptop", "amount": 1500},
    {"user_id": 1, "product": "Mouse", "amount": 50},
    {"user_id": 2, "product": "Keyboard", "amount": 100}
  ]
}

Output:
| name    | total_orders | total_spent |
|---------|--------------|-------------|
| Alice   | 2            | 1550        |
| Bob     | 1            | 100         |
| Charlie | 0            | NULL        |

Note: Execute SQL is for small datasets and testing purposes, not for production database queries.


Supported SQL Dialects

DialectNameStatus
athenaAmazon Athenaโœ… Official
bigqueryGoogle BigQueryโœ… Official
clickhouseClickHouseโœ… Official
databricksDatabricksโœ… Official
dorisApache Dorisโœ… Community
drillApache Drillโœ… Community
duckdbDuckDBโœ… Official
hiveApache Hiveโœ… Official
mysqlMySQLโœ… Official
oracleOracleโœ… Official
postgresPostgreSQLโœ… Official
prestoPrestoโœ… Official
redshiftAmazon Redshiftโœ… Official
snowflakeSnowflakeโœ… Official
sparkApache Sparkโœ… Official
sqliteSQLiteโœ… Official
starrocksStarRocksโœ… Official
teradataTeradataโœ… Community
trinoTrinoโœ… Official
tsqlT-SQL (SQL Server)โœ… Official

License

Apache License 2.0

Acknowledgments

This plugin is powered by SQLGlot, an excellent SQL parser and transpiler library created by Toby Mao.