Skip to content

Commit

Permalink
fix: sql (#13)
Browse files Browse the repository at this point in the history
* fix: same table concurrency request

* feat: add init expr to make query
  • Loading branch information
sunchanglong authored Dec 18, 2024
1 parent abed377 commit ab52708
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/querybuilder/QueryWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function PromQueryEditorByApp(props: PromQueryEditorProps & SqlQueryEdito

const onChangeMode = (mode) => {
setMode(mode)
store.set('sqltype', mode)
// store.set('sqltype', mode)
props.onChange({...props.query, sqltype: mode} as PromQuery & SQLQuery)
// props.onChange()
}
Expand Down
2 changes: 1 addition & 1 deletion src/querybuilder/mysql/MySqlDatasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MySqlDatasource extends SqlDatasource {
return [];
}
const queryString = buildColumnQuery(query.table, query.dataset);
const frame = await this.runSql<string[]>(queryString, { refId: query.table + 'fields' });
const frame = await this.runSql<string[]>(queryString, { refId: query.table + 'fields' + Math.random()});
const fields = frame.map((f) => ({
name: f[0],
text: f[0],
Expand Down
2 changes: 2 additions & 0 deletions src/querybuilder/mysql/sql/components/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export function SqlQueryEditor({
const onQueryChange = (q: SQLQuery, process = true) => {
setQueryToValidate(q);
onChange(q);
q.expr = 'greptimedb_expr_placeholder'
onChange(q);

if (haveColumns(q.sql?.columns) && q.sql?.columns.some((c) => c.name) && !queryRowFilter.group) {
setQueryRowFilter({ ...queryRowFilter, group: true });
Expand Down

0 comments on commit ab52708

Please sign in to comment.