Commit a4a5047f authored by Lucas Fernandes de Oliveira's avatar Lucas Fernandes de Oliveira

Merge branch 'issue/71' into 'develop'

Issue #71: Add link for yaml files

See merge request !72
parents f00a8a08 b5bdf2e2
Pipeline #17180 passed with stages
in 1 minute and 2 seconds
-
name: "dim:2"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:3"
dataType: "string"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:4"
dataType: "string"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:5"
dataType: "boolean"
description: "A dimension of Blendb. Has 2 possible values."
-
name: "dim:6"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:7"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:8"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:9"
dataType: "integer"
parent: "dim:0"
relation: "day"
description: "A dimension of Blendb. Has 30 possible values."
-
name: "dim:10"
dataType: "integer"
parent: "dim:0"
relation: "month"
description: "A dimension of Blendb. Has 12 possible values."
-
name: "dim:11"
dataType: "integer"
parent: "dim:0"
relation: "year"
description: "A dimension of Blendb. Has 1 possible value."
-
name: "enumtype:1"
values:
- "test_4"
- "test_5"
- "test_6"
- "string"
-
name: "enumtype:2"
values:
- "test_7"
- "test_8"
-
name: "enumtype:3"
values:
- "test_9"
-
name: "met:2"
dataType: "integer"
aggregation: "avg"
description: "No meaning, just used for test"
-
name: "met:3"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:4"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:5"
dataType: "integer"
aggregation: "avg"
description: "No meaning, just used for test"
-
name: "met:6"
dataType: "integer"
aggregation: "count"
description: "No meaning, just used for test"
-
name: "met:7"
dataType: "integer"
aggregation: "count"
description: "No meaning, just used for test"
-
name: "met:8"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:9"
dataType: "integer"
aggregation: "count"
description: "No meaning, just used for test"
-
name: "met:10"
dataType: "integer"
aggregation: "max"
description: "No meaning, just used for test"
-
name: "met:11"
dataType: "integer"
aggregation: "min"
description: "No meaning, just used for test"
-
name: "source_1"
description: "source with 2 entries"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "enumtype"
enumType: "enumtype:0"
-
name: "fields:1"
description: "second entry"
dataType: "string"
-
name: "source_2"
description: "source with one entry and undefined dataType"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "string"
-
name: "source_3"
description: "source with one entry and without description"
fields:
-
name: "fields:0"
dataType: "string"
-
name: "source_4"
description: "source with all core types from blendb"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "integer"
-
name: "fields:1"
description: "second entry"
dataType: "float"
-
name: "fields:2"
description: "third entry"
dataType: "string"
-
name: "fields:3"
description: "fourth entry"
dataType: "boolean"
-
name: "fields:4"
description: "fifth entry"
dataType: "date"
......@@ -2,307 +2,77 @@
# however a config file for tests in CI is required
# so this example file in fact is the CI test file
views:
-
alias: "View 0"
data: "test/postgres/fixtures/view0.json"
origin: true
dimensions:
- "dim:0"
- "dim:7"
metrics:
- "met:0"
- "met:1"
- "met:2"
- "met:10"
-
alias: "View 1"
data: "test/postgres/fixtures/view1.json"
origin: true
dimensions:
- "dim:1"
- "dim:8"
metrics:
- "met:3"
- "met:4"
-
alias: "View 2"
data: "test/postgres/fixtures/view2.json"
origin: true
dimensions:
- "dim:2"
metrics:
- "met:5"
- "met:6"
- "met:11"
-
alias: "View 3"
data: "test/postgres/fixtures/view3.json"
origin: true
dimensions:
- "dim:2"
- "dim:3"
- "dim:4"
-
alias: "View 4"
data: "test/postgres/fixtures/view4.json"
origin: true
dimensions:
- "dim:2"
- "dim:7"
- "dim:8"
-
alias: "View 5"
data: "test/postgres/fixtures/view5.json"
origin: true
dimensions:
- "dim:3"
metrics:
- "met:7"
-
alias: "View 6"
data: "test/postgres/fixtures/view6.json"
origin: true
dimensions:
- "dim:4"
metrics:
- "met:8"
-
alias: "View 7"
data: "test/postgres/fixtures/view7.json"
origin: true
dimensions:
- "dim:4"
- "dim:5"
- "dim:6"
-
alias: "View 8"
data: "test/postgres/fixtures/view8.json"
origin: true
dimensions:
- "dim:5"
- "dim:6"
metrics:
- "met:9"
-
alias: "view 9"
data: "test/postgres/fixtures/view9.json"
origin: false
dimensions:
- "dim:2"
metrics:
- "met:5"
- "met:6"
- "met:7"
clauses:
- "dim:2!=1"
metrics:
-
name: "met:0"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:1"
dataType: "integer"
aggregation: "avg"
description: "No meaning, just used for test"
-
name: "met:2"
dataType: "integer"
aggregation: "avg"
description: "No meaning, just used for test"
-
name: "met:3"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:4"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:5"
dataType: "integer"
aggregation: "avg"
description: "No meaning, just used for test"
-
name: "met:6"
dataType: "integer"
aggregation: "count"
description: "No meaning, just used for test"
-
name: "met:7"
dataType: "integer"
aggregation: "count"
description: "No meaning, just used for test"
-
name: "met:8"
dataType: "integer"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "met:9"
dataType: "integer"
aggregation: "count"
description: "No meaning, just used for test"
-
name: "met:10"
dataType: "integer"
aggregation: "max"
description: "No meaning, just used for test"
-
name: "met:11"
dataType: "integer"
aggregation: "min"
description: "No meaning, just used for test"
dimensions:
-
name: "dim:0"
dataType: "date"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:1"
dataType: "date"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:2"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:3"
dataType: "string"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:4"
dataType: "string"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:5"
dataType: "boolean"
description: "A dimension of Blendb. Has 2 possible values."
-
name: "dim:6"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:7"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:8"
dataType: "integer"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "dim:9"
dataType: "integer"
parent: "dim:0"
relation: "day"
description: "A dimension of Blendb. Has 30 possible values."
-
name: "dim:10"
dataType: "integer"
parent: "dim:0"
relation: "month"
description: "A dimension of Blendb. Has 12 possible values."
-
name: "dim:11"
dataType: "integer"
parent: "dim:0"
relation: "year"
description: "A dimension of Blendb. Has 1 possible value."
enumTypes:
-
name: "enumtype:0"
values:
- "male"
- "female"
- "binary"
- "undecided"
-
name: "enumtype:1"
values:
- "test_4"
- "test_5"
- "test_6"
- "string"
-
name: "enumtype:2"
values:
- "test_7"
- "test_8"
-
name: "enumtype:3"
values:
- "test_9"
sources:
-
name: "source_0"
description: "source with 3 entries"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "string"
-
name: "fields:1"
description: "second entry"
dataType: "string"
-
name: "fields:2"
description: "third entry"
dataType: "string"
-
name: "source_1"
description: "source with 2 entries"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "enumtype"
enumType: "enumtype:0"
-
name: "fields:1"
description: "second entry"
dataType: "string"
-
name: "source_2"
description: "source with one entry and undefined dataType"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "string"
-
name: "source_3"
description: "source with one entry and without description"
fields:
links:
- config/ci_views.yaml.example
obj:
-
name: "fields:0"
dataType: "string"
-
name: "source_4"
description: "source with all core types from blendb"
fields:
alias: "View 0"
data: "test/postgres/fixtures/view0.json"
origin: true
dimensions:
- "dim:0"
- "dim:7"
metrics:
- "met:0"
- "met:1"
- "met:2"
- "met:10"
metrics:
links:
- config/ci_metrics.yaml.example
- config/ci_metrics_1.yaml.example
obj:
-
name: "fields:0"
description: "first entry"
name: "met:0"
dataType: "integer"
-
name: "fields:1"
description: "second entry"
dataType: "float"
aggregation: "sum"
description: "No meaning, just used for test"
-
name: "fields:2"
description: "third entry"
dataType: "string"
name: "met:1"
dataType: "integer"
aggregation: "avg"
description: "No meaning, just used for test"
dimensions:
links:
- config/ci_dimensions.yaml.example
obj:
-
name: "fields:3"
description: "fourth entry"
dataType: "boolean"
name: "dim:0"
dataType: "date"
description: "A dimension of Blendb. Has 5 possible values."
-
name: "fields:4"
description: "fifth entry"
name: "dim:1"
dataType: "date"
description: "A dimension of Blendb. Has 5 possible values."
enumTypes:
links:
- config/ci_enumtypes.yaml.example
obj:
-
name: "enumtype:0"
values:
- "male"
- "female"
- "binary"
- "undecided"
sources:
links:
- config/ci_sources.yaml.example
obj:
-
name: "source_0"
description: "source with 3 entries"
fields:
-
name: "fields:0"
description: "first entry"
dataType: "string"
-
name: "fields:1"
description: "second entry"
dataType: "string"
-
name: "fields:2"
description: "third entry"
dataType: "string"
\ No newline at end of file
-
alias: "View 1"
data: "test/postgres/fixtures/view1.json"
origin: true
dimensions:
- "dim:1"
- "dim:8"
metrics:
- "met:3"
- "met:4"
-
alias: "View 2"
data: "test/postgres/fixtures/view2.json"
origin: true
dimensions:
- "dim:2"
metrics:
- "met:5"
- "met:6"
- "met:11"
-
alias: "View 3"
data: "test/postgres/fixtures/view3.json"
origin: true
dimensions:
- "dim:2"
- "dim:3"
- "dim:4"
-
alias: "View 4"
data: "test/postgres/fixtures/view4.json"
origin: true
dimensions:
- "dim:2"
- "dim:7"
- "dim:8"
-
alias: "View 5"
data: "test/postgres/fixtures/view5.json"
origin: true
dimensions:
- "dim:3"
metrics:
- "met:7"
-
alias: "View 6"
data: "test/postgres/fixtures/view6.json"
origin: true
dimensions:
- "dim:4"
metrics:
- "met:8"
-
alias: "View 7"
data: "test/postgres/fixtures/view7.json"
origin: true
dimensions:
- "dim:4"
- "dim:5"
- "dim:6"
-
alias: "View 8"
data: "test/postgres/fixtures/view8.json"
origin: true
dimensions:
- "dim:5"
- "dim:6"
metrics:
- "met:9"
-
alias: "view 9"
data: "test/postgres/fixtures/view9.json"
origin: false
dimensions:
- "dim:2"
metrics:
- "met:5"
- "met:6"
- "met:7"
clauses:
- "dim:2!=1"
......@@ -57,15 +57,25 @@ export interface ViewParsingOptions {
*/
interface ConfigSchema {
/** Options of all sources available */
sources: SourceStrOptions[];
sources: { obj: SourceStrOptions[],
links: string[],
};
/** Options of all views available */
views: ViewParsingOptions[];
views: { obj: ViewParsingOptions[],
links: string[],
};
/** Options of all metrics available */
metrics: MetricStrOptions[];
metrics: { obj: MetricStrOptions[],
links: string[],
};
/** Options of all dimensions available */
dimensions: DimensionStrOptions[];
dimensions: { obj: DimensionStrOptions[],
links: string[],
};
/** Options of all enumerable types available */
enumTypes: EnumTypeOptions[];
enumTypes: { obj: EnumTypeOptions[],
links: string[],
};
}
/** Information required to build a SQL view code. */
......@@ -164,11 +174,11 @@ export class ConfigParser {
host: process.env.BLENDB_DB_HOST,
port: parseInt(process.env.BLENDB_DB_PORT, 10)
};
let metricsOpts = config.metrics;
let viewsOpts = config.views;
let dimensionsOpts = config.dimensions;
let enumTypesOpts = config.enumTypes;
let sourcesOpts = config.sources;
let metricsOpts = config.metrics.obj;
let viewsOpts = config.views.obj;
let dimensionsOpts = config.dimensions.obj;
let enumTypesOpts = config.enumTypes.obj;
let sourcesOpts = config.sources.obj;
let parsed: ParsedConfig = {
adapter: process.env.BLENDB_ADAPTER || "postgres",
connection: connection,
......@@ -179,7 +189,28 @@ export class ConfigParser {
loadViews: [],
buildViews: [],
sources: []
};
};
for (let i = 0; i < config.sources.links.length; i++) {
sourcesOpts = sourcesOpts.concat(yaml.safeLoad(fs.readFileSync(
config.sources.links[i], { encoding: "utf-8"})) as SourceStrOptions[]);
}
for (let i = 0; i < config.views.links.length; i++) {
viewsOpts = viewsOpts.concat(yaml.safeLoad(fs.readFileSync(
config.views.links[i], { encoding: "utf-8"})) as ViewParsingOptions[]);
}
for (let i = 0; i < config.metrics.links.length; i++) {
metricsOpts = metricsOpts.concat(yaml.safeLoad(fs.readFileSync(
config.metrics.links[i], { encoding: "utf-8"})) as MetricStrOptions[]);
}
for (let i = 0; i < config.dimensions.links.length; i++) {
dimensionsOpts = dimensionsOpts.concat(yaml.safeLoad(fs.readFileSync(
config.dimensions.links[i], { encoding: "utf-8"})) as DimensionStrOptions[]);
}
for (let i = 0; i < config.enumTypes.links.length; i++) {
enumTypesOpts = enumTypesOpts.concat(yaml.safeLoad(fs.readFileSync(
config.enumTypes.links[i], { encoding: "utf-8"})) as EnumTypeOptions[]);
}
let metMap: MetricMap = {};
let dimMap: DimensionMap = {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment