CrackSQL: A Hybrid Dialect Translation System Powered by LLM

Read full text
Authors: Wei Zhou, Yuyang Gao, Xuanhe Zhou, G Li
Cited by: 1
References: 4

Abstract

SQL dialect translation is critical for enabling interoperability across different database systems. However, translating queries between dialects (e.g., PostgreSQL to MySQL) remains challenging due to syntactic discrepancies and subtle semantic mismatches. Existing approaches (i.e., manual translation, rule-based systems, LLM-based methods) either demand substantial engineering effort (e.g., crafting custom translation rules) or suffer from reliability issues (e.g., hallucinating non-existent functions), especially when dealing with complex queries. In this demonstration, we present CrackSQL, the first hybrid SQL dialect translation system that integrates rule-based techniques with LLM-based methods to overcome these limitations. CrackSQL is built on three key innovations: (1) A functionality-based query processing module that decomposes lengthy, complex SQLs into manageable functional units, reducing hallucination risk; (2) A cross-dialect syntax embedding model that aligns textual syntax specifications to support accurate syntax matching; (3) An adaptive local-to-global translation strategy that incrementally expands translation scope to preserve semantic correctness. CrackSQL supports three translation modes and offers flexible deployment options via a web console, PyPI package, and command-line interface, thus enabling seamless integration in both interactive and batch translation scenarios. CrackSQL is fully implemented and available at: https://github.com/weAIDB/CrackSQL.

Fields of Study & Subjects

Natural Language Processing Techniques Authorship Attribution and Profiling Network Packet Processing and Optimization

Publication details

Journal / source
Companion of the International Conference on Management of Data
Publisher
ACM
Pages
154–157
Publication date
26 May 2026