feat(engine): Add StarRocks engine support#5832
Conversation
- **Add StarRocks engine support to SQLMesh** via StarRocks’ MySQL-compatible protocol. - Ship **engine adapter + docs + real integration tests** to ensure generated SQL works on StarRocks. - **User demand / adoption**: StarRocks is a common OLAP choice; SQLMesh users want to run the same model lifecycle (build, incremental maintenance, views/MVs) on StarRocks without bespoke SQL. - **Engine-specific semantics**: StarRocks differs from vanilla MySQL in DDL/DML constraints (e.g., key types, delete behavior, rename caveats). An adapter is needed to produce correct and predictable SQL. - **Confidence & maintainability**: Documenting config patterns + codifying behavior with integration tests prevents regressions and makes support “real” (not just “it parses”). - **Connectivity**: Connect through MySQL protocol (e.g., `pymysql`). - **Table creation / DDL**: - Key table types via `physical_properties`: **DUPLICATE KEY (default)**, **PRIMARY KEY (recommended for incremental)**, **UNIQUE KEY** - **Partitioning**: simple `partitioned_by` and advanced `partition_by` (complex expression partitioning) + optional initial `partitions` - **Distribution**: `distributed_by` structured form or string fallback (HASH / RANDOM; buckets required) - **Ordering**: `order_by` / `clustered_by` - **Generic PROPERTIES passthrough** (string key/value) - **Views**: - Regular views - **Materialized views** via `kind VIEW(materialized true)` with StarRocks-specific notes/constraints - **DML / maintenance**: - Insert/select/update basics - Delete behavior handled with StarRocks compatibility constraints (PRIMARY KEY tables recommended for robust deletes) - **Engine adapter**: `sqlmesh/core/engine_adapter/starrocks.py` - **Docs**: `docs/integrations/engines/starrocks.md` - **Integration tests**: `tests/core/engine_adapter/integration/test_integration_starrocks.py`, and `tests/core/engine_adapter/test_starrocks.py` - **Integration tests require a running StarRocks** instance. - Ran: - set `STARROCKS_HOST/PORT/USER/PASSWORD` - `pytest -m "starrocks and docker" tests/core/engine_adapter/integration/test_integration_starrocks.py` - **No sync MV support (currently)** - **No tuple IN**: `(c1, c2) IN ((v1, v2), ...)` - **No `SELECT ... FOR UPDATE`** - **RENAME caveat**: rename target can’t be qualified with a database name - **Changes are StarRocks-scoped** (adapter/docs/tests) and should not impact other engines. Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
And optimize some test cases. Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: jaogoy <jaogoy@gmail.com> Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
…ose file Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
* Making optional but failing requirements mandatory * Fixing unit tests * Documentation updates Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
Signed-off-by: Mateusz Jukiewicz <mateusz@marketer.tech>
|
@jukiewiczm-marketer thanks for this PR! I just merged this and since it's a new adapter, let's continue monitoring issues and improving it as things come up. Again, thanks for your work on this. |
|
@StuffbyYuki sounds great, thanks. |
|
@jukiewiczm-marketer It looks like we just manually push it. I might suggest to the core team that we do this weekly or something going forward! |
|
@jukiewiczm-marketer this is available in the newst release. But for some reason the starrocks docs don't show up on the website. Let me know if you have any good idea, I'll continue figuring out why that might be |
|
Thanks for the update @StuffbyYuki 🙏. I'll check it out tomorrow, I only edited the docs that were created in the original PR so never investigated if there are any issues with them showing up. |


Description
This PR is based on a great work of @jaogoy and his original PR with StarRocks support implementation. Given his permission, I took over the implementation and added the following:
Calling the sqlmesh maintainers that were called/commented on the original pr @erindru @StuffbyYuki
Test Plan
I tested it locally in various scenarios (especially related to AMVs) + there are plenty of unit tests for the engine.
Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO