DW-SQL-Builder is a DataWeave library that allows you to build dynamic SQL queries. This simplifies the process of generating SQL queries inside Mule apps, providing more flexibility and customization when querying databases.
- Dynamic SQL query building using DataWeave.
- Flexible and customizable queries.
- Easy to integrate with Mule applications.
- Simple to use and implement.
To get started with DW-SQL-Builder, simply clone the repository and follow the instructions in the documentation.
DW-SQL-Builder is easy to use and can be integrated with your Mule application in a few simple steps:
DW script:
%dw 2.0
output text/plain
import * from builder::SQLBuilder
---
SELECT columns ["a", "b"]
FROM ("a" AS "alias" INNERJOIN "b" ON condition("column1", "=", "value1") INNERJOIN "c" ON condition("column1", "=", "value1"))
WHERE ( NOT (condition("column1", "IS NOT NULL")) AND NOT("column2 <> 'c'") OR "column2 <> 'c'")
GROUPBY ["a"]
HAVING condition("column1", "=", "value1")
LIMIT 2000
build true
Output:
SELECT a, b
FROM (a AS alias INNER JOIN b ON column1 = value1) INNER JOIN c ON column1 = value1
WHERE ((NOT column1 IS NOT NULL AND NOT (column2 <> 'c')) OR column2 <> 'c')
GROUP BY a
HAVING column1 = value1
LIMIT 2000
For more usage examples, check out the documentation.
- group By ✅
- order by ✅
- limit ✅
- fix alias ❌
- fix NOT function ✅
- Implement operators:
BETWEEN ✅ LIKE ❌ IN ❌ EXISTS ❌ ANY ❌ ALL ❌
Contributions to DW-SQL-Builder are always welcome! If you have any ideas, suggestions or bug reports, please open an issue or a pull request.
Feel free to customize this template with your project's specific information.