Commit Graph

285 Commits

Author SHA1 Message Date
Sven Klemm
c1890dbb6d fix timeColumnType assignment 2018-08-18 12:28:05 +02:00
Sven Klemm
9699d7a166 make suggested filter macro depend on type 2018-08-18 12:11:10 +02:00
Sven Klemm
18ce6fc280 use unixEpochGroup macro for unix timestamp 2018-08-18 12:04:32 +02:00
Sven Klemm
998bb6ebe3 Merge branch 'master' into postgres-query-builder 2018-08-18 11:54:39 +02:00
Marcus Efraimsson
313a8bd033
Merge pull request #12891 from svenklemm/unixepochgroup
add $__unixEpochGroup and $__unixEpochGroupAlias to sql datasources
2018-08-17 14:41:33 +02:00
Sven Klemm
8e4db8cc3a suggest operators depending on datatype 2018-08-17 10:38:23 +02:00
Sven Klemm
28f97a2450 update persisted parts on param change 2018-08-16 13:23:38 +02:00
Sven Klemm
e84a1cbcc5 persist datatype information 2018-08-16 12:50:32 +02:00
Sven Klemm
8ced29a0e7 Don't do value suggestions for numeric and timestamp 2018-08-16 11:48:36 +02:00
Sven Klemm
735c4abe6c rename postgres_query.jest.ts to .test.ts 2018-08-15 12:06:32 +02:00
Sven Klemm
907e8fd77c fix variable escaping 2018-08-15 11:37:30 +02:00
Sven Klemm
a2f4441f9d autodetect timescaledb when version >= 9.6 2018-08-15 10:42:15 +02:00
Sven Klemm
2d12801186 detect postgres version for saved datasources 2018-08-15 09:48:06 +02:00
Sven Klemm
2606f6e715 use pointer cursor for buttons in query editor 2018-08-15 09:21:17 +02:00
Sven Klemm
6d8ad3b076 require postgres 9.4+ for ordered set aggregate functions 2018-08-14 15:49:37 +02:00
Sven Klemm
9d022766ee add postgres version to datasource config 2018-08-14 15:45:55 +02:00
Sven Klemm
c90eb45cef only show first/last aggregate when timescaledb is enabled 2018-08-14 15:29:29 +02:00
Sven Klemm
e12d07dd68 keep jsonData in PostgresDatasource 2018-08-14 15:27:58 +02:00
Sven Klemm
5b3b0295e8 Merge branch 'master' into postgres-query-builder 2018-08-14 15:10:16 +02:00
Marcus Efraimsson
660530a3a6
Merge pull request #12914 from dehrax/12224-final
Karma to Jest: rename and cleanup
2018-08-14 12:55:23 +02:00
Sven Klemm
15c8ef6c95 Merge branch 'master' into postgres-query-builder 2018-08-14 12:51:03 +02:00
Tobias Skarhed
a65589a5fb Rename test files 2018-08-14 10:52:41 +02:00
Sven Klemm
bfe28ee061 Add $__unixEpochGroup macro to postgres datasource 2018-08-13 12:08:14 +02:00
Sven Klemm
c9bbdf244c get timecolumn datatype on timecolumn change 2018-08-13 11:29:35 +02:00
Sven Klemm
1dd8192d51 fix datatype query 2018-08-13 09:57:46 +02:00
Sven Klemm
a4a33d80db mention time_bucket in timescaledb tooltip 2018-08-09 17:30:46 +02:00
Sven Klemm
c3aad10047 change timescaledb to checkbox instead of select 2018-08-09 10:05:35 +02:00
Sven Klemm
b987aee7cf add timescaledb option to postgres datasource
This adds an option to the postgres datasource config for
timescaledb support. When set to auto it will check for
timescaledb when testing the datasource.

When this option is enabled the $__timeGroup macro will
use the time_bucket function from timescaledb to group
times by an interval.

This also passes the datasource edit control to testDatasource
to allow for setting additional settings, this might be useful
for other datasources aswell which have optional or version
dependant features which can be queried.
2018-08-09 10:05:35 +02:00
Sven Klemm
13d0fa4b9a add previous fill mode to query builder 2018-08-08 12:23:41 +02:00
Sven Klemm
3b6454ab88 Merge branch 'master' into postgres-query-builder 2018-08-08 12:09:17 +02:00
Sven Klemm
52c7edf2f4 rename last fillmode to previous 2018-08-07 21:11:51 +02:00
Sven Klemm
6d07d825e9 dont break default parameters for functions 2018-08-03 18:38:40 +02:00
Sven Klemm
e4ae8be9fa fix suggestion query 2018-08-03 14:09:41 +02:00
Sven Klemm
aa830211fe dont order for aggregate 2018-08-03 10:15:28 +02:00
Sven Klemm
dabfd88cd9 add moving average to query builder 2018-08-03 07:44:36 +02:00
Sven Klemm
0b57e88f9e adjust frontend test 2018-08-03 06:19:53 +02:00
Sven Klemm
2cae966e6c use $__timeGroupAlias macro 2018-08-02 21:40:15 +02:00
Sven Klemm
bfc66a7ed0 add fillmode "last" to sql datasource
This adds a new fill mode last (last observation carried forward) for grafana
to the sql datasources. This fill mode will fill in the last seen value in a
series when a timepoint is missing or NULL if no value for that series has
been seen yet.
2018-08-02 20:35:09 +02:00
Sven Klemm
67edb9e9fe Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-08-02 16:39:27 +02:00
Marcus Efraimsson
5cca478656
Merge pull request #12760 from svenklemm/postgres-timegroup
remove alias from postgres $__timeGroup macro

add $__timeGroupAlias macro to all sql datasources
2018-08-02 16:36:01 +02:00
Sven Klemm
7e9c9199c1 add warning when switching from raw sql mode 2018-08-02 10:15:53 +02:00
Sven Klemm
a221d9ec84 add more prominent button for switching edit mode 2018-08-02 09:50:21 +02:00
Sven Klemm
82c473e3af document $__timeGroupAlias 2018-08-01 21:23:00 +02:00
Brice Maron
bb7e583863 fix custom variable quoting in sql* query interpolations 2018-08-01 20:32:50 +02:00
Sven Klemm
43295f9c18 remove alias from postgres $__timeGroup macro 2018-08-01 08:50:19 +02:00
Sven Klemm
6613f11499 Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-07-30 15:23:56 +02:00
Sven Klemm
ace999b13f rename special to windows 2018-07-29 15:56:22 +02:00
Sven Klemm
26ea88252b add first and last support 2018-07-29 15:00:13 +02:00
Sven Klemm
412bb6acab refactor function handling in query builder 2018-07-29 13:31:50 +02:00
Sven Klemm
5327580939 refactor column function handling 2018-07-28 21:41:23 +02:00
Sven Klemm
6ca7a03975 consistent nameing fro group and select 2018-07-28 12:53:36 +02:00
Sven Klemm
7905c29875 adjust metric prefix code to sql engine refactor 2018-07-27 15:34:04 +02:00
Sven Klemm
ad26a319c5 refactor schema query generation 2018-07-27 14:02:12 +02:00
Sven Klemm
97f24733f5 remove tableschema from query builder ui 2018-07-27 10:58:08 +02:00
Sven Klemm
b3ebc86093 fix window function query without group by 2018-07-23 07:52:42 +02:00
Sven Klemm
e1a37cf275 add order by to metadata queries 2018-07-22 17:12:30 +02:00
Sven Klemm
7af9cd7dfc set explicit order for rate and increase 2018-07-22 15:20:40 +02:00
Sven Klemm
84d7743939 fix pre gui queries shortcircuit 2018-07-21 10:38:34 +02:00
Sven Klemm
9f0b4e0aa7 add groupby when adding first aggregate 2018-07-18 13:29:47 +02:00
Sven Klemm
0e608a08c2 fix test for query generation 2018-07-15 22:58:25 +02:00
Sven Klemm
7f348f3836 dont run queries if target has no table set 2018-07-15 22:27:33 +02:00
Sven Klemm
43686616a0 add query to find metric table 2018-07-15 22:26:32 +02:00
Sven Klemm
b49d10104e add popover for metric column 2018-07-15 19:13:19 +02:00
Sven Klemm
b28bf1a4f9 rename PostgresQueryBuilder to PostgresMetaQuery 2018-07-15 17:12:03 +02:00
Sven Klemm
070b556fd3 dont expand variables in rawSql 2018-07-15 17:02:26 +02:00
Sven Klemm
2fcb09b23d filter datatype for groupby suggestions 2018-07-15 16:23:47 +02:00
Sven Klemm
6e824e81bf fix rate special function when using group by 2018-07-15 15:14:12 +02:00
Sven Klemm
c3c20ef2e2 remove unused import 2018-07-15 12:52:00 +02:00
Sven Klemm
f85c9c012e refactor adding sqlPart 2018-07-15 12:26:22 +02:00
Sven Klemm
f48060a1bb remove render code from sql_part 2018-07-15 09:53:22 +02:00
Sven Klemm
d9648f1fe7 fix bug in query generation with metricColumn 2018-07-15 09:43:38 +02:00
Sven Klemm
fa66645b0f refactor PostgresQuery 2018-07-15 09:36:49 +02:00
Sven Klemm
844beb660d refactor PostgresQueryCtrl 2018-07-14 21:00:06 +02:00
Sven Klemm
d7ed706e12 refactor PostgresQueryCtrl and PostgresQuery 2018-07-14 20:28:34 +02:00
Sven Klemm
2dc9d4e960 refactor addGroupBy and removeGroupByPart 2018-07-14 16:46:53 +02:00
Sven Klemm
569a8567f9 use let for variable declaration 2018-07-14 11:32:00 +02:00
Sven Klemm
d0c2b19c51 Add templateSrv to PostgresQuery tests 2018-07-14 11:05:35 +02:00
Sven Klemm
b745fab190 add tests for query generation 2018-07-13 22:29:10 +02:00
Sven Klemm
17591ca29f fix tests for postgres datasource 2018-07-13 10:15:55 +02:00
Sven Klemm
693efda4d5 send timerange with metricFindQuery 2018-07-13 09:31:39 +02:00
Sven Klemm
bf21f1bf76 indent generated SQL 2018-07-12 22:36:41 +02:00
Sven Klemm
a24a6624e3 handle counter overflow and resets in rate 2018-07-12 13:15:19 +02:00
Sven Klemm
0935526d23 partition by metricColumn when using increase 2018-07-12 10:13:21 +02:00
Sven Klemm
bbe7b9b908 add rate and increase special functions 2018-07-12 09:57:04 +02:00
Sven Klemm
2784a2df6b Refactor value column SQL generation 2018-07-11 13:03:06 +02:00
Sven Klemm
9ba42f63f1 Refactor metric column sql generation 2018-07-11 12:33:37 +02:00
Sven Klemm
a86e77fc68 Refactor group by query generation 2018-07-11 12:20:24 +02:00
Sven Klemm
b9edc3c611 Refactor where clause generation 2018-07-11 11:50:02 +02:00
Sven Klemm
5dd236bf05 refactor SQL generation for value columns 2018-07-11 11:09:28 +02:00
Sven Klemm
772825ed09 Refactor time column sql generation 2018-07-11 11:00:12 +02:00
Sven Klemm
c5bde0ef45 Refactor render function on PostgresQuery 2018-07-11 10:50:49 +02:00
Sven Klemm
1d711924bc Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-07-11 10:21:13 +02:00
Sven Klemm
c8a11d597f prepare sql part for special functions 2018-07-10 21:43:57 +02:00
Sven Klemm
0e610cad1b set query gui as default handle old panels gracefully 2018-07-10 21:40:59 +02:00
Sven Klemm
9d5b4cb91d dont throw exception for unknown types 2018-07-10 14:45:36 +02:00
Sven Klemm
e8e24f6139 add alias when adding group by 2018-07-10 11:32:23 +02:00
Sven Klemm
6e7161f238 add aggregates when adding group by 2018-07-10 11:14:00 +02:00
Sven Klemm
dc93055a10 add column alias when add aggregate function 2018-07-10 10:19:30 +02:00
Sven Klemm
5b5dcabd22 add None to metric column suggestions 2018-07-07 21:21:11 +02:00
Sven Klemm
8490ae41b6 handle pre query gui queries gracefully 2018-07-07 20:41:24 +02:00
Sven Klemm
eb170e741b dont break on panels that dont have rawQuery set 2018-07-07 19:59:25 +02:00
Sven Klemm
b2b4860bdb refactor transformToSegments 2018-07-07 19:43:21 +02:00
Sven Klemm
e4b4b3a772 rename quoteLiteral to quoteIdentAsLiteral 2018-07-06 12:38:43 +02:00
Sven Klemm
a63298bca2 remove unused function removeSelect 2018-07-06 11:25:20 +02:00
Sven Klemm
6143924ec6 fix where clause generation 2018-07-06 10:56:47 +02:00
Sven Klemm
7600c6efcb remove hardcoded $__timeFilter, make macros functional in where clause 2018-07-06 10:38:52 +02:00
Sven Klemm
85ab1cfa8f fix constraint removal 2018-07-06 09:28:34 +02:00
Sven Klemm
d8c7756489 dont autoquote, suggest quoted values if requried 2018-07-05 21:36:39 +02:00
Sven Klemm
3f614e635b do not autoquote identifiers 2018-07-05 11:27:19 +02:00
Sven Klemm
c604651092 fix group by ui 2018-07-05 10:19:22 +02:00
Sven Klemm
3595436614 fix where constraint handling 2018-07-04 18:57:55 +02:00
Sven Klemm
7d30ca04de remove dead code from sql_part
fix where clause query generation
2018-07-04 15:37:06 +02:00
Tobias Skarhed
74bf80962d Add mock to test files 2018-07-04 14:32:22 +02:00
Tobias Skarhed
962340bcd1 Create new instance in beforeEach 2018-07-04 14:32:22 +02:00
Tobias Skarhed
3bbe39c5ad Karma to Jest: postgres datasource 2018-07-04 14:30:36 +02:00
Sven Klemm
fee36b2b35 include where constraints in query generation 2018-07-04 12:22:45 +02:00
Sven Klemm
ced0a5828f rearrange elements of query builder 2018-07-04 11:56:26 +02:00
Sven Klemm
9847c2186f mv query_part to sql_part 2018-07-04 11:39:58 +02:00
Sven Klemm
410449b5e7 use sqlPart for ui parts 2018-06-30 11:11:34 +02:00
Sven Klemm
17b46804e8 remove unused function renderAdhocFilters 2018-05-27 19:39:43 +02:00
Sven Klemm
8b47d7c520 set style for registered query components 2018-05-21 12:53:06 +02:00
Sven Klemm
a5bcd8eac0 fix metric column when using group by 2018-05-21 12:10:18 +02:00
Sven Klemm
3af4e4e0d6 separate label in template from type 2018-05-21 11:44:37 +02:00
Sven Klemm
e93276b1f8 use sql part component 2018-05-21 11:10:00 +02:00
Sven Klemm
de9a117dc6 use sql part component 2018-05-21 11:04:52 +02:00
Sven Klemm
b12d049f6f quote column name in buildValueQuery 2018-05-19 17:21:53 +02:00
Sven Klemm
731c7520b3 return values quotes for suggestions in where expression 2018-05-19 15:34:48 +02:00
Sven Klemm
1dd2bce054 Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-05-05 13:33:54 +02:00
Marcus Efraimsson
3a5d1f4594
tsdb: update query and annotation editor help texts for postgres
In addition to closing #11578
2018-04-16 23:56:14 +02:00
Sven Klemm
4599329683 set default for sslmode to verify-full in postgres datasource editor (#11615) 2018-04-16 22:23:24 +02:00
Mario Trangoni
e5e6bc56c8 public: fix codespell issues 2018-04-13 20:31:29 +02:00
Sven Klemm
fa170b3cc6 Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-03-28 20:43:15 +02:00
Sven Klemm
8b3c308168 remove categories from queryPart 2018-03-26 20:15:16 +02:00
Sven Klemm
d6ac7aee89 remove unused import 2018-03-26 18:50:03 +02:00
Sven Klemm
6c2ef7dca6 handle aggregate functions more generic 2018-03-26 18:34:40 +02:00
Sven Klemm
12600a0e95 support non-nested menu entries 2018-03-26 13:19:14 +02:00
Marcus Efraimsson
66c03f84f5 postgres: fix precision for the time column in table/annotation query mode
Use the ConvertSqlTimeColumnToEpochMs function to convert any native
datetime data type or epoch time (millisecond precision).
Additional tests and update of existing due to timezone issues
running postgres on UTC and dev environment on non-utc.
Added test dashboard.
2018-03-22 15:32:33 +01:00
Sven Klemm
46c229188e read aggregate functions from database 2018-03-14 23:03:32 +01:00
Sven Klemm
0c3afd0e9c add buildAggregateQuery 2018-03-14 22:59:48 +01:00
Sven Klemm
64fa1ce8a0 properly handle IN queries 2018-03-14 18:09:47 +01:00
Sven Klemm
6793fa5e54 join multivalue variables with , 2018-03-13 23:33:40 +01:00
Sven Klemm
e6501f0f0e revert special handling for IN 2018-03-13 23:24:26 +01:00
Sven Klemm
5e9a66de5f put values for IN in parens 2018-03-13 23:19:56 +01:00
Sven Klemm
958646d976 dont quote where constraints 2018-03-13 23:15:25 +01:00
Sven Klemm
b7c7030a46 add regex operators 2018-03-13 23:06:39 +01:00
Sven Klemm
cdb4e2ba0b remove unused setting 2018-03-13 21:31:07 +01:00
Sven Klemm
e780b1bce5 cleanup where segment handling 2018-03-11 12:06:54 +01:00
Sven Klemm
0b358ff5f3 remove limit 2018-03-10 22:39:42 +01:00
Sven Klemm
cb5278d413 handle variables in where constraints 2018-03-10 20:18:03 +01:00
Sven Klemm
1d8540ac69 properly quote where constraint parts 2018-03-09 18:18:12 +01:00