3XCode CLI is a command-line tool that converts legacy SQL (stored procedures, functions, views, and triggers) into production-quality PySpark code, using a multi-phase AI pipeline rather than a single one-shot prompt. It's built for teams migrating off T-SQL, PL/SQL, PL/pgSQL, MySQL, or generic ANSI SQL onto Spark, and for teams cleaning up existing Spark SQL into idiomatic PySpark.
The Problem
- Slow, manual rewriting: engineers hand-translate stored procedures line by line.
- Easy to get subtly wrong: NULL ordering, date-function argument order, and window-frame semantics differ silently between dialects and Spark.
- No dependency awareness: converting files in isolation means a procedure gets translated before the view it depends on even exists.
- Hard to trust: without validation, "converted" code that quietly fails at runtime (or silently returns wrong results) looks the same as code that works.
The Solution
- Multi-phase AI pipeline: Discovery, Planning, Conversion, Validation, and Auto-Fix run as distinct, chained phases instead of one black-box prompt.
- Dependency-ordered conversion: views and functions convert before the procedures and triggers that reference them, so downstream code sees real signatures, never guesses.
- Built-in gotcha knowledge: DATEDIFF argument order, NULL semantics, case-sensitivity, deprecated APIs (
unionAll,registerTempTable) are checked automatically. - Safe auto-fix: targeted repairs are applied to real issues and automatically reverted if a fix breaks syntax or truncates the file.
How It Works
Every conversion, whether a single file or a bulk directory of hundreds, runs the same 5-phase pipeline. Each phase is a distinct step with its own output, so failures are honest (you get a clear audit, never a silent false "success") and each phase's output feeds the next.
Discovery
Reads the SQL file, detects the source dialect (T-SQL, PL/SQL, PL/pgSQL, MySQL, ANSI, Spark SQL) and inventories every object (procedures, functions, views, triggers) with exact line ranges, dependencies, and complexity.
Planning
Builds a cross-object dependency graph and orders conversion into levels (views and functions before the procedures and triggers that depend on them), distilling targeted, per-object instructions.
Conversion
Converts each object into production-quality PySpark, tier by tier, so dependent code always sees the real signatures of what it calls rather than guessing.
Validation
A three-stage review (local syntax checks, dependency cross-checking, and a full Claude review against the gotcha checklist) flags issues by severity.
Auto-Fix
Targeted repairs are applied to HIGH/ERROR-severity issues only; a fix is automatically reverted if it fails to parse or shrinks the file by more than 50%.
# Convert a single file 3xcode pyspark convert your_file.sql # Convert an entire directory in parallel 3xcode pyspark convert --dir ./sql/ --session "my-migration" -w 4 # Resume an interrupted bulk session 3xcode pyspark convert --resume session-20260321-batch-1
Key Capabilities
Multi-Provider Support
Convert using Anthropic (direct API), AWS Bedrock, Google Vertex AI, or Azure AI Foundry: pick the provider that matches your infrastructure and compliance requirements.
BYOK (Bring Your Own Key)
Store your own provider API keys locally via your OS keychain and route conversions directly to your own provider account instead of the platform-provided key.
Bulk Conversion
Point at a directory of .sql files and convert them all with configurable parallel workers and simple-first or complex-first scheduling, resumable if interrupted.
Workspace & Session Management
Organize conversions into workspaces and track every run as a resumable session: list, inspect, rename, cancel, or resume any session, across all your registered workspaces.
Local Web UI
Run `3xcode ui` for a browser-based workspace: upload files, watch live conversion progress, browse sessions, and manage settings, all served locally on your machine.
Your Code Never Touches Our Servers
Source SQL is sent only to your chosen LLM provider, never to the 3XDE backend. The backend handles auth, licensing, and usage tracking only; conversion prompts and knowledge are fetched at runtime but your code is never part of that traffic.
Pricing & Tiers
3XCode CLI is a proprietary, commercial tool with a free tier. Every plan includes the full 5-phase pipeline and multi-provider support. Plans differ in monthly conversion volume and the number of machines a license can be active on. BYOK is admin-gated and can be enabled per account on request.
| Tier | Conversions / Month | Machines per License |
|---|---|---|
| Free | 5 | 1 |
| Pro | 200 | 2 |
| Team | 1,000 | 10 |
| Enterprise | Unlimited | 999 |
Organizations can share a single admin-provisioned license across members. Shared licenses are exempt from the per-machine cap. See Organizations for details.
Ready to Get Started
Install 3XCode CLI and convert your first file
Install with pip install 3xcode-cli, log in, initialize a workspace, and run your first conversion in minutes.