sql2odata
Translate SQL statements into valid OData v4 query syntax — directly inside VS Code.

Features
sql2odata provides an interactive translator panel and a context-menu command that converts familiar SQL syntax into OData v4 URLs and request bodies.
Interactive Translator Panel
Open the translator panel via the Command Palette (Cmd+Shift+P / Ctrl+Shift+P) and run sql2odata: Open sql2odata Translator. The panel provides:
- A SQL input editor where you type or paste SQL statements
- An OData output panel showing the translated OData URL, HTTP method, and request body (if applicable)
- A parameter breakdown table for quick reference of each OData query option
- One-click examples for common query patterns
- Copy to clipboard with a single click
Translate Selected SQL
Select any SQL text in your editor, right-click, and choose Translate SQL Selection to OData. The result is shown in an output channel and automatically copied to your clipboard.
Keyboard Shortcut
Press Cmd+Shift+O (macOS) or Ctrl+Shift+O (Windows/Linux) to open the translator panel instantly.
Supported SQL Syntax
| SQL Clause |
OData v4 Equivalent |
SELECT col1, col2 |
$select=col1,col2 |
SELECT * |
(no $select — returns all fields) |
SELECT COUNT(*) |
$count=true |
FROM Table |
/Table (Entity Set) |
WHERE col = 'val' |
$filter=col eq 'val' |
WHERE col LIKE '%text%' |
$filter=contains(col,'text') |
WHERE col LIKE 'text%' |
$filter=startswith(col,'text') |
WHERE col LIKE '%text' |
$filter=endswith(col,'text') |
WHERE col IN ('a','b') |
$filter=(col eq 'a' or col eq 'b') |
WHERE col BETWEEN 1 AND 10 |
$filter=col ge 1 and col le 10 |
WHERE col IS NULL |
$filter=col eq null |
WHERE col IS NOT NULL |
$filter=col ne null |
AND / OR / NOT |
and / or / not |
= / <> / != |
eq / ne |
> / >= / < / <= |
gt / ge / lt / le |
ORDER BY col ASC |
$orderby=col asc |
LIMIT n / TOP n |
$top=n |
OFFSET n |
$skip=n |
JOIN Table ON ... |
$expand=Table |
GROUP BY col |
$apply=groupby((col)) |
GROUP BY + COUNT/SUM/AVG/MIN/MAX |
$apply=groupby((...),aggregate(...)) |
HAVING condition |
$apply=.../filter(...) |
INSERT INTO ... VALUES |
POST + JSON body |
UPDATE ... SET ... WHERE |
PATCH + JSON body |
DELETE FROM ... WHERE |
DELETE |
Examples
Simple SELECT:
SELECT Name, Age, City FROM Customers WHERE Country = 'Germany' ORDER BY Name ASC LIMIT 10
Result:
GET /Customers?$select=Name,Age,City&$filter=Country eq 'Germany'&$orderby=Name asc&$top=10
INSERT:
INSERT INTO Products (Name, Price, Category) VALUES ('Widget', 29.99, 'Tools')
Result:
POST /Products
{
"Name": "Widget",
"Price": 29.99,
"Category": "Tools"
}
JOIN / $expand:
SELECT OrderID, ProductName FROM Orders JOIN OrderItems ON Orders.ID = OrderItems.OrderID
Result:
GET /Orders?$select=OrderID,ProductName&$expand=OrderItems
Requirements
- VS Code 1.85.0 or later
- No additional dependencies required
Extension Settings
This extension does not add any VS Code settings.
Known Limitations
- Subqueries are not supported
- Complex JOIN conditions are simplified to
$expand
- Nested
$expand with $filter inside expanded entities is not yet supported
- SQL functions (e.g.,
UPPER(), LOWER()) are not translated
Release Notes
0.0.1
- Initial release
- Interactive translator panel with examples
- Context-menu command for translating selected SQL
- Support for SELECT, INSERT, UPDATE, DELETE
- Full WHERE clause translation including LIKE, IN, BETWEEN, IS NULL
- JOIN to $expand mapping
- GROUP BY with aggregate functions to $apply
- Copy-to-clipboard functionality
License
MIT
Author
Ulrich Waldmann — moonraker@magenta.de