queries:
  -
   mappings:
      tableCreateQuery:
      foreignKeyQuery:
      tableCheckQuery:
      recordSelectQuery:
      recordSelectAppMetricsQuery:
      recordSelectAgregatedAppMetricsQuery:
      recordSelectWorkerThroughputQuery:
      recordSelectWorkerAggregateThroughputQuery:
      recordSelectWorkerMetricsQuery:
      recordSelectWorkerAggregateMetricsQuery:
      recordInsertQuery:
      recordDeleteQuery:
      selectAppComponentList:
      selectAppComponentMetrics:
      selectAppComponentHistory:
      selectAppComponentAggregatedHistory:
      doubleType:
      floatType:
      integerType:
      longType:
      stringType:
      booleanType:

   type: default
   version: default
  -
   mappings:
      tableCreateQuery: CREATE TABLE IF NOT EXISTS {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
      tableCheckQuery: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
      foreignKeyQuery: FOREIGN KEY (WORKERID) REFERENCES WORKERS_CONFIGURATION(WORKERID)
      recordSelectQuery: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} {{CONDITION}}
      recordSelectAppMetricsQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP ORDER BY result.TIMESTAMP
      recordSelectAgregatedAppMetricsQuery: select AVG(result2.val) as {{RESULT}} ,DATEDIFF('SECOND','1970-01-01',DATEADD('SECOND',ROUND(result2.time /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}, DATE '1970-01-01'))*1000 as AGG_TIMESTAMP from (select {{COLUMNS}} AS val,result.TIMESTAMP as time from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY  TIMESTAMP)result GROUP BY result.TIMESTAMP)result2  group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
      recordSelectWorkerThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP ORDER BY result.TIMESTAMP
      recordSelectWorkerAggregateThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.AGG_TIMESTAMP from (select {{RESULT}},DATEDIFF('SECOND','1970-01-01',DATEADD('SECOND',ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}, DATE '1970-01-01'))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result group by result.AGG_TIMESTAMP ORDER BY result.AGG_TIMESTAMP
      recordSelectWorkerMetricsQuery: select VALUE,TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      recordSelectWorkerAggregateMetricsQuery: select AVG(CAST(VALUE as DECIMAL(22,2))) as VALUE,DATEDIFF('SECOND','1970-01-01',DATEADD('SECOND',ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}, DATE '1970-01-01'))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
      recordInsertQuery: INSERT INTO {{TABLE_NAME}} {{COLUMNS}} VALUES ({{Q}})
      recordDeleteQuery: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
      selectAppComponentList: select DISTINCT NAME from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
      selectAppComponentMetrics: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} ORDER BY TIMESTAMP DESC  LIMIT 1
      selectAppComponentHistory: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      selectAppComponentAggregatedHistory: select {{ALL_COLUMS_EXPRESSION}},DATEDIFF('SECOND','1970-01-01',DATEADD('SECOND',ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}, DATE '1970-01-01'))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
      doubleType: DECIMAL
      floatType: FLOAT
      integerType: INTEGER
      longType: BIGINT
      stringType: "VARCHAR(255)"
      booleanType:  "TINYINT(1)"
   type: H2
   version: default
  -
   mappings:
      tableCreateQuery: CREATE TABLE IF NOT EXISTS {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
      tableCheckQuery: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
      foreignKeyQuery: FOREIGN KEY (WORKERID) REFERENCES WORKERS_CONFIGURATION(WORKERID)
      recordSelectQuery: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} {{CONDITION}}
      recordSelectAppMetricsQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP
      recordSelectWorkerThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP
      recordSelectWorkerAggregateThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.AGG_TIMESTAMP from (select {{RESULT}},UNIX_TIMESTAMP(from_unixtime(ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.AGG_TIMESTAMP ORDER BY result.AGG_TIMESTAMP
      recordSelectWorkerMetricsQuery: select VALUE,TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
      recordSelectWorkerAggregateMetricsQuery: select AVG(CAST(VALUE as DECIMAL(22,2))) as VALUE ,UNIX_TIMESTAMP(from_unixtime(ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} GROUP BY AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
      recordInsertQuery: INSERT INTO {{TABLE_NAME}} {{COLUMNS}} VALUES ({{Q}})
      recordDeleteQuery: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
      selectAppComponentList: select DISTINCT NAME from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
      selectAppComponentMetrics: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} ORDER BY TIMESTAMP DESC  LIMIT 1
      selectAppComponentHistory: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      selectAppComponentAggregatedHistory: select {{ALL_COLUMS_EXPRESSION}},UNIX_TIMESTAMP(from_unixtime(ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
      recordSelectAgregatedAppMetricsQuery: select AVG(result2.val) as {{RESULT}} ,UNIX_TIMESTAMP(from_unixtime(ROUND(result2.time/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from (select {{COLUMNS}} AS val,result.TIMESTAMP as time from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY  TIMESTAMP)result GROUP BY result.TIMESTAMP)result2  group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
      doubleType: DECIMAL
      floatType: FLOAT
      integerType: INTEGER
      longType: BIGINT
      stringType: "VARCHAR(255)"
      booleanType:  "TINYINT(1)"
   type: MySQL
   version: default
  -
   mappings:
      tableCreateQuery: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
      tableCheckQuery: SELECT TOP 1 1 from {{TABLE_NAME}}
      foreignKeyQuery: FOREIGN KEY (WORKERID) REFERENCES WORKERS_CONFIGURATION(WORKERID)
      recordSelectQuery: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} {{CONDITION}}
      recordSelectAppMetricsQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP ORDER BY result.TIMESTAMP
      recordSelectWorkerThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP ORDER BY result.TIMESTAMP
      #todo: fix with proper one
      recordSelectWorkerAggregateThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.AGG_TIMESTAMP from (select AVG({{RESULT}}) AS {{RESULT}},(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.AGG_TIMESTAMP ORDER BY result.AGG_TIMESTAMP
      recordSelectWorkerMetricsQuery: select VALUE,TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      #todo: fix with proper one
      recordSelectWorkerAggregateMetricsQuery: select AVG(TRY_CAST(VALUE as DECIMAL(22,2))) as VALUE ,(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} GROUP BY (TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000) ORDER BY AGG_TIMESTAMP
      recordInsertQuery: INSERT INTO {{TABLE_NAME}} {{COLUMNS}} VALUES ({{Q}})
      recordDeleteQuery: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
      selectAppComponentList: select DISTINCT NAME from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
      selectAppComponentMetrics: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} ORDER BY TIMESTAMP DESC  LIMIT 1
      selectAppComponentHistory: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      #todo: fix with proper one
      selectAppComponentAggregatedHistory: select {{ALL_COLUMS_EXPRESSION}},(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} group by (TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000) ORDER BY AGG_TIMESTAMP
      #todo: fix with proper one
      recordSelectAgregatedAppMetricsQuery: select AVG(result2.val) as {{RESULT}} ,(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from (select {{COLUMNS}} AS val,result.TIMESTAMP as TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP)result2  group by (ROUND((TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)) ORDER BY AGG_TIMESTAMP
      doubleType: "FLOAT(32)"
      floatType: REAL
      integerType: INTEGER
      longType: BIGINT
      stringType: "VARCHAR(255)"
      booleanType:  BIT
   type: Microsoft SQL Server
   version: default
  -
   mappings:
      tableCreateQuery: CREATE TABLE {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
      tableCheckQuery: SELECT 1 FROM {{TABLE_NAME}} WHERE rownum=1
      foreignKeyQuery: FOREIGN KEY (WORKERID) REFERENCES WORKERS_CONFIGURATION(WORKERID)
      recordSelectQuery: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} {{CONDITION}}
      recordSelectAppMetricsQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP ORDER BY result.TIMESTAMP
      recordSelectWorkerThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP ORDER BY result.TIMESTAMP
      #todo: fix with proper one
      recordSelectWorkerAggregateThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.AGG_TIMESTAMP from (select AVG({{RESULT}}) AS {{RESULT}},(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.AGG_TIMESTAMP ORDER BY result.AGG_TIMESTAMP
      recordSelectWorkerMetricsQuery: select VALUE,TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      #todo: fix with proper one
      recordSelectWorkerAggregateMetricsQuery: select AVG(CAST(VALUE as DECIMAL(22,2))) as VALUE ,(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} GROUP BY ROUND(TIMESTAMP/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0) ORDER BY AGG_TIMESTAMP
      recordInsertQuery: INSERT INTO {{TABLE_NAME}} {{COLUMNS}} VALUES ({{Q}})
      recordDeleteQuery: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
      selectAppComponentList: select DISTINCT NAME from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
      selectAppComponentMetrics: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} ORDER BY TIMESTAMP DESC  LIMIT 1
      selectAppComponentHistory: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
      #todo: fix with proper one
      selectAppComponentAggregatedHistory: select {{ALL_COLUMS_EXPRESSION}},(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} group by (TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000) ORDER BY AGG_TIMESTAMP
      #todo: fix with proper one
      recordSelectAgregatedAppMetricsQuery: select AVG(result2.val) as {{RESULT}} ,(ROUND(MAX(TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)*(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000)) as AGG_TIMESTAMP from (select {{COLUMNS}} AS val,result.TIMESTAMP as TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP)result2  group by (ROUND((TIMESTAMP)/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000),0)) ORDER BY AGG_TIMESTAMP
      doubleType: "NUMBER(19,4)"
      floatType:  "NUMBER(19,4)"
      integerType: "NUMBER(10)"
      longType: "NUMBER(19)"
      stringType: "VARCHAR(255)"
      booleanType:  "NUMBER(1)"
   type: Oracle
   version: default
  -
    mappings:
       tableCreateQuery: CREATE TABLE IF NOT EXISTS {{TABLE_NAME}} ({{COLUMNS, PRIMARY_KEYS}})
       tableCheckQuery: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
       foreignKeyQuery: FOREIGN KEY (WORKERID) REFERENCES WORKERS_CONFIGURATION(WORKERID)
       recordSelectQuery: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} {{CONDITION}}
       recordSelectAppMetricsQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP
       recordSelectWorkerThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.TIMESTAMP from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.TIMESTAMP
       recordSelectWorkerAggregateThroughputQuery: select {{COLUMNS}} AS {{RESULT}},result.AGG_TIMESTAMP from (select {{RESULT}},UNIX_TIMESTAMP(from_unixtime(ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}})result GROUP BY result.AGG_TIMESTAMP ORDER BY result.AGG_TIMESTAMP
       recordSelectWorkerMetricsQuery: select VALUE,TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
       recordSelectWorkerAggregateMetricsQuery: select AVG(CAST(VALUE as DECIMAL(22,2))) as VALUE ,UNIX_TIMESTAMP(from_unixtime(ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND NAME={{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} GROUP BY AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
       recordInsertQuery: INSERT INTO {{TABLE_NAME}} {{COLUMNS}} VALUES ({{Q}})
       recordDeleteQuery: DELETE FROM {{TABLE_NAME}} {{CONDITION}}
       selectAppComponentList: select DISTINCT NAME from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}}
       selectAppComponentMetrics: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} ORDER BY TIMESTAMP DESC  LIMIT 1
       selectAppComponentHistory: SELECT {{COLUMNS}} FROM {{TABLE_NAME}} WHERE SOURCE={{WORKER_ID}} AND  name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY TIMESTAMP
       selectAppComponentAggregatedHistory: select {{ALL_COLUMS_EXPRESSION}},UNIX_TIMESTAMP(from_unixtime(ROUND(TIMESTAMP /(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
       recordSelectAgregatedAppMetricsQuery: select AVG(result2.val) as {{RESULT}} ,UNIX_TIMESTAMP(from_unixtime(ROUND(result2.time/(60*{{TIME_AGGREGATION_IN_MINUTES}}*1000))*60*{{TIME_AGGREGATION_IN_MINUTES}}))*1000 as AGG_TIMESTAMP from (select {{COLUMNS}} AS val,result.TIMESTAMP as time from (select * from {{TABLE_NAME}} where SOURCE={{WORKER_ID}} AND name like {{NAME}} AND TIMESTAMP BETWEEN {{BEGIN_TIME_MILLISECONDS}} AND {{CURRENT_TIME_MILLISECONDS}} ORDER BY  TIMESTAMP)result GROUP BY result.TIMESTAMP)result2  group by AGG_TIMESTAMP ORDER BY AGG_TIMESTAMP
       doubleType: DECIMAL
       floatType: REAL
       integerType: INTEGER
       longType: BIGINT
       stringType: "VARCHAR(255)"
       booleanType: "SMALLINT"
    type: PostgreSQL
    version: default
