From 3366d744114af3db40df25fa376688d11aa17e04 Mon Sep 17 00:00:00 2001 From: Sam Jewell <2903904+samjewell@users.noreply.github.com> Date: Mon, 31 Mar 2025 13:29:12 +0100 Subject: [PATCH] SQL Expressions: Improve placeholder SQL Query (#103092) This gives the user more hints as to how to succeed with SQL Expressions --- public/app/features/expressions/components/SqlExpr.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/app/features/expressions/components/SqlExpr.tsx b/public/app/features/expressions/components/SqlExpr.tsx index e753d42a549..2d7747c8d17 100644 --- a/public/app/features/expressions/components/SqlExpr.tsx +++ b/public/app/features/expressions/components/SqlExpr.tsx @@ -28,7 +28,12 @@ interface Props { export const SqlExpr = ({ onChange, refIds, query }: Props) => { const vars = useMemo(() => refIds.map((v) => v.value!), [refIds]); - const initialQuery = `select * from ${vars[0]} limit 1`; + const initialQuery = `-- Run MySQL-dialect SQL against the tables returned from your data sources. +-- Data source queries (ie "${vars[0]}") are available as tables and referenced by query-name +-- Fields are available as columns, as returned from the data source. +SELECT * +FROM ${vars[0]} +LIMIT 10`; const styles = useStyles2(getStyles); const containerRef = useRef(null); const [dimensions, setDimensions] = useState({ height: 0 });