Commit Graph

296 Commits

Author SHA1 Message Date
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
Sven Klemm
340f679d0f quote schema and table 2018-03-09 18:09:59 +01:00
Sven Klemm
83200c289a use metricColumn in query builder 2018-03-04 23:32:23 +01:00
Sven Klemm
bf4a30d30f set rawSQL when rendering query builder query 2018-03-04 19:46:11 +01:00
Sven Klemm
26e09b598c fix group by column 2018-03-04 19:35:43 +01:00
Sven Klemm
e8c6341fed clean up aggregation functions 2018-03-04 10:18:11 +01:00
Sven Klemm
7104e6f9f8 fix variable interpolation 2018-03-03 22:11:51 +01:00
Sven Klemm
fd518846b1 rename field to column 2018-03-03 20:57:00 +01:00
Sven Klemm
c5de5ed5be Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-02-21 08:24:04 +01:00
Daniel Lee
6fa46d9539 plugins: update meta data for all core plugins
So that the readme's can be published on Grafana.com
2018-02-15 16:50:38 +01:00
Carl Bergquist
fcca578f41 updates readmes for mysql and postgres (#10913)
ref #10813
2018-02-15 09:38:39 +01:00
Sven Klemm
ef18eb7fcb add where constraint handling 2018-02-08 10:25:32 +01:00
Sven Klemm
3bce45d8a6 add query_builder 2018-02-08 10:19:43 +01:00
Sven Klemm
382a525477 make metricColumn functional 2018-02-03 18:26:57 +01:00
Sven Klemm
c65a964cdd add metric column selector 2018-02-03 18:03:00 +01:00
Sven Klemm
4dbd83fac1 add groupby to querybuilder
remove unused aggregations
2018-01-31 15:32:32 +01:00
Sven Klemm
571ecdc740 enhance render function 2018-01-30 22:57:38 +01:00
Sven Klemm
443504517a add postgres_query.ts 2018-01-30 22:13:55 +01:00
Sven Klemm
438b10bcd6 query builder changes 2018-01-30 14:10:38 +01:00
Sven Klemm
a59e052a0f more query builder components 2018-01-30 14:08:10 +01:00
Sven Klemm
17be31e216 call render in query 2018-01-28 22:16:51 +01:00
Sven Klemm
33ac22bfdb start query builder ui 2018-01-21 22:08:18 +01:00
Torkel Ödegaard
27835f373e cleanup: removed unused typescript typings import 2018-01-04 10:12:02 +01:00
Torkel Ödegaard
3a1f52d8a2 prettier: ran on all files again, sorry. now settings are defined in package.json 2017-12-21 08:39:31 +01:00
Torkel Ödegaard
85879a7014 prettier: change to single quoting 2017-12-20 12:33:33 +01:00
Torkel Ödegaard
fadfc665e4 tech: ran pretttier on all typescript files 2017-12-19 16:06:54 +01:00
Sven Klemm
ce809de1ed postgres: change $__timeGroup macro to include "AS time" column alias (#10119)
* change $__timeGroup macro to include column alias

* update docs and help text for $__timeGroup macro
2017-12-08 15:14:10 +01:00
Sven Klemm
b44c599410 postgres: pass timerange for template variable queries (#10069)
* pass timerange for template queries when refresh is set to timerange
change

* document on time range change refresh mode for template queries
2017-12-07 10:05:04 +01:00
Sven Klemm
108f582ec4 sync documentation, add remark about to_timestamp and redshift (#9841) 2017-11-14 11:33:55 +01:00
Sven Klemm
caa8b6100e always quote template variables for postgres when multi-value or include (#9714)
all is allowed
2017-10-31 12:23:21 +01:00
Daniel Lee
e541e60bc3 sql: remove title from annotation help
Fixes #9710
2017-10-29 20:03:23 +01:00
Sven Klemm
34da0711ab add __timeGroup macro for mysql (#9596)
* add __timeGroup macro for mysql

* put example __timeGroup query in frontend help

* do __timeGroup interval parsing in go similar to mysql

* ignore whitespace around interval
2017-10-27 11:26:25 +02:00
Sven Klemm
56e53b8343 dont quote variables for mysql and postgres datasource (#9611) 2017-10-24 14:05:41 +02:00
Sven Klemm
b2d880c6de modify $__timeGroup macro so it can be used in select clause (#9527)
* modify $__timeGroup macro so it can be used in select clause

* fix $__interval_ms for postgres datasource

* use $__timeGroup macro in documentation

* fix annotation template query
remove title since its no longer used and add tags instead

* change __timeFilter macro to work on postgresql < 8.1 and redshift
2017-10-18 18:10:01 +02:00
Daniel Lee
7713009caa postgres: add missing ngInject decorator 2017-10-11 09:15:55 +02:00
Daniel Lee
d1c9760fa8 Postgres Data Source (#9475)
* add postgresql datasource

* add rest of files for postgres datasource

* fix timeseries query, remove unused code

* consistent naming, refactoring

* s/mysql/postgres/

* s/mysql/postgres/

* couple more tests

* tests for more datatypes

* fix macros for postgres

* add __timeSec macro

* add frontend for postgres datasource

* adjust documentation

* fix formatting

* add proper plugin description

* merge editor changes from mysql

* port changes from mysql datasource

* set proper defaultQuery for postgres

* add time_sec to timeseries query
accept int for value for timeseries query

* revert allowing time_sec and handle int or float values as unix
timestamp for "time" column

* fix tslint error

* handle decimal values in timeseries query

* allow setting sslmode for postgres datasource

* use type switch for handling data types

* fix value for timeseries query

* refactor timeseries queries to make them more flexible

* remove debug statement from inner loop in type conversion

* use plain for loop in getTypedRowData

* fix timeseries queries

* adjust postgres datasource to tsdb refactoring

* adjust postgres datasource to frontend changes

* update lib/pq to latest version

* move type conversion to getTypedRowData

* handle address types cidr, inet and macaddr

* adjust response parser and docs for annotations

* convert unknown types to string

* add documentation for postgres datasource

* add another example query with metric column

* set more helpful default query

* update help text in query editor

* handle NULL in value column of timeseries query

* add __timeGroup macro

* add test for __timeGroup macro

* document __timeGroup and set proper default query for annotations

* fix typos in docs

* add postgres to list of datasources

* add postgres to builtInPlugins

* mysql: refactoring as prep for merging postgres

Refactors out the initialization of the xorm engine and the query logic
for an sql data source.

* mysql: rename refactoring + test update

* postgres:refactor to use SqlEngine(same as mysql)

Refactored to use a common base class with the MySql data source.

Other changes from the original PR:
- Changed time column to be time_sec to allow other time units in the
future and to be the same as MySQL
- Changed integration test to test the main Query method rather than
the private transformToTable method
- Changed the __timeSec macro name to __timeEpoch
- Renamed PostgresExecutor to PostgresQueryEndpoint

Fixes #9209 (the original PR)

* postgres: encrypt password on config page

With some other cosmetic changes to the config page:
- placeholder texts
- reset button for the password after it has been encrypted.
- default value for the sslmode field.

* postgres: change back col name to time from time_sec

* postgres mysql: remove annotation title

Title has been removed from annotations

* postgres: fix images for docs page

* postgres mysql: fix specs
2017-10-10 15:19:14 +02:00