feat: 重构数据空间与 SQL 工作台
- 提供连接管理、逻辑表编排和轻量 SQL 工作台 - 增加 SQL 补全、执行分析、结果分栏与导出交互 - 统一数据空间导航、图标和编辑器体验
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { formatCalciteSql } from './dataspace-sql';
|
||||
|
||||
describe('formatCalciteSql', () => {
|
||||
it('formats common Calcite query clauses', () => {
|
||||
expect(
|
||||
formatCalciteSql(
|
||||
'select o.id, c.name from MYSQL_1.MAIN.outlet o join PG_2.PUBLIC.customer c on c.id=o.id where o.name is not null order by o.id desc limit 100',
|
||||
),
|
||||
).toBe(
|
||||
'SELECT o.id, c.name\nFROM MYSQL_1.MAIN.outlet o\nJOIN PG_2.PUBLIC.customer c ON c.id=o.id\nWHERE o.name is not null\nORDER BY o.id DESC\nLIMIT 100;\n',
|
||||
);
|
||||
});
|
||||
|
||||
it('preserves quoted keyword literals', () => {
|
||||
expect(formatCalciteSql("select 'from where' as label from demo")).toBe(
|
||||
"SELECT 'from where' AS label\nFROM demo;\n",
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user