Skip to content

Commit da0a7b7

Browse files
authored
docs: Various updates (#7599)
* Wrapping of inline code blocks * Some visual love on the Azure VPC page * Fix links on the Multitenancy page * Remove redundant "supports multiple data sources" column from data source pages * Fix broken images (after removing old docs platform * Add fiscal year recipe * Clarify controlling log levels in Monitoring Integrations
1 parent b5d4ccd commit da0a7b7

32 files changed

+342
-303
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.Code {
2-
white-space: nowrap;
3-
}
4-
51
pre > .Code {
62
white-space: inherit;
73
}

docs/pages/guides/recipes.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ These recipes will show you the best practices of using Cube.
3030
### Data modeling
3131

3232
- [Working around string time dimensions](/guides/recipes/data-modeling/string-time-dimensions)
33+
- [Implementing fiscal year or fiscal quarter dimensions](/guides/recipes/data-modeling/fiscal-year-quarter-dimensions)
3334
- [Calculating average and percentiles](/guides/recipes/data-modeling/percentiles)
3435
- [Implementing data snapshots](/guides/recipes/data-modeling/snapshots)
3536
- [Implementing Entity-Attribute-Value model](/guides/recipes/data-modeling/entity-attribute-value)

docs/pages/guides/recipes/data-modeling/_meta.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
"string-time-dimensions": "Working around string time dimensions",
3+
"fiscal-year-quarter-dimensions": "Implementing fiscal year or fiscal quarter dimensions",
34
"dynamic-union-tables": "Using dynamic union tables",
45
"entity-attribute-value": "Implementing Entity-Attribute-Value Model (EAV)",
56
"passing-dynamic-parameters-in-a-query": "Passing dynamic parameters in a query",
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Implementing fiscal year or fiscal quarter dimensions
2+
3+
Businesses and governments use the concept of a [fiscal year][wiki-fiscal-year]
4+
for the convenience of their accounting, budgeting, and reporting. Often,
5+
the fiscal year would not align with the calendar year (January 1 to December 31).
6+
In that case, the fiscal year may either lag or lead by a number of months.
7+
8+
## Use case
9+
10+
We'd like to analyze business metrics by attributing them to specific fiscal
11+
years and quarters within those years. In this recipe, we'll be using
12+
[Australia][wiki-fiscal-year-australia] as an example: in this country, the
13+
"financial year" 6 month earlier than the calendar year, i.e., FY 2024
14+
started on July 1, 2023.
15+
16+
## Data modeling
17+
18+
Let's define a couple of auxillary dimensions (`fiscal_year_internal` and
19+
`fiscal_quarter_internal`) that would translate the time dimension into
20+
numeric values of the fiscal year and fiscal quarter, respectively. Make
21+
sure to adjust the calculations in these dimensions if your fiscal year is
22+
defined differently. Also, you can see that these dimensions are defined
23+
as [private][ref-dimension-public] so they are not visible to end users.
24+
25+
Then, define a string dimension (`fiscal_quarter`) that would format the
26+
fiscal quarter value and expose it to end users:
27+
28+
```yml
29+
cubes:
30+
- name: fiscal
31+
sql: >
32+
SELECT '2024-01-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
33+
SELECT '2024-02-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
34+
SELECT '2024-03-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
35+
SELECT '2024-04-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
36+
SELECT '2024-05-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
37+
SELECT '2024-06-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
38+
SELECT '2024-07-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
39+
SELECT '2024-08-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
40+
SELECT '2024-09-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
41+
SELECT '2024-10-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
42+
SELECT '2024-11-15T00:00:00.000Z'::TIMESTAMP AS timestamp UNION ALL
43+
SELECT '2024-12-15T00:00:00.000Z'::TIMESTAMP AS timestamp
44+
45+
dimensions:
46+
- name: timestamp
47+
sql: timestamp
48+
type: time
49+
50+
# TODO: Adjust to your fiscal calendar
51+
- name: fiscal_year_internal
52+
sql: "EXTRACT(YEAR FROM {timestamp} - INTERVAL '6 MONTH')"
53+
type: string
54+
public: false
55+
56+
# TODO: Adjust to your fiscal calendar
57+
- name: fiscal_quarter_internal
58+
sql: >
59+
CASE
60+
WHEN EXTRACT(MONTH FROM {timestamp}) BETWEEN 7 AND 9 THEN 1
61+
WHEN EXTRACT(MONTH FROM {timestamp}) BETWEEN 10 AND 12 THEN 2
62+
WHEN EXTRACT(MONTH FROM {timestamp}) BETWEEN 1 AND 3 THEN 3
63+
WHEN EXTRACT(MONTH FROM {timestamp}) BETWEEN 4 AND 6 THEN 4
64+
END
65+
type: string
66+
public: false
67+
68+
- name: fiscal_quarter
69+
sql: >
70+
'FY' || {fiscal_year_internal} || '-Q' || {fiscal_quarter_internal}
71+
type: string
72+
```
73+
74+
## Result
75+
76+
Now you can use the `fiscal_quarter` dimension in your queries and get desired result:
77+
78+
<Screenshot src="https://ucarecdn.com/c03579f2-f7e0-40aa-a723-310a5762ab54/"/>
79+
80+
81+
[wiki-fiscal-year]: https://en.wikipedia.org/wiki/Fiscal_year
82+
[wiki-fiscal-year-australia]: https://en.wikipedia.org/wiki/Fiscal_year#Australia
83+
84+
[ref-dimension-public]: /reference/data-model/dimensions#public

docs/pages/product/configuration/advanced/multitenancy.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -375,21 +375,21 @@ input.
375375
[ref-config]: /reference/configuration/config
376376
[ref-config-opts]: /reference/configuration/config
377377
[ref-config-db]: /product/configuration/data-sources
378-
[ref-config-driverfactory]: /reference/configuration/config#driverfactory
379-
[ref-config-repofactory]: /reference/configuration/config#repositoryfactory
378+
[ref-config-driverfactory]: /reference/configuration/config#driver_factory
379+
[ref-config-repofactory]: /reference/configuration/config#repository_factory
380380
[ref-config-preagg-schema]:
381-
/reference/configuration/config#preaggregationsschema
382-
[ref-config-ctx-to-appid]: /reference/configuration/config#contexttoappid
381+
/reference/configuration/config#pre_aggregations_schema
382+
[ref-config-ctx-to-appid]: /reference/configuration/config#context_to_app_id
383383
[ref-config-ctx-to-orch-id]:
384-
/reference/configuration/config#contexttoorchestratorid
384+
/reference/configuration/config#context_to_orchestrator_id
385385
[ref-config-multi-data-src]:
386386
/product/configuration/advanced/multiple-data-sources
387-
[ref-config-query-rewrite]: /reference/configuration/config#queryrewrite
387+
[ref-config-query-rewrite]: /reference/configuration/config#query_rewrite
388388
[ref-config-refresh-ctx]:
389-
/reference/configuration/config#scheduledrefreshcontexts
389+
/reference/configuration/config#scheduled_refresh_contexts
390390
[ref-config-refresh-tz]:
391-
/reference/configuration/config#scheduledrefreshtimezones
392-
[ref-config-security-ctx]: /reference/configuration/config#securitycontext
391+
/reference/configuration/config#scheduled_refresh_timezones
392+
[ref-config-security-ctx]: /product/auth/context
393393
[ref-security]: /product/auth
394394
[ref-cube-datasource]: /reference/data-model/cube#data_source
395-
[ref-cube-security-ctx]: /reference/data-model/cube#security-context
395+
[ref-cube-security-ctx]: /reference/data-model/context-variables#compile_context

docs/pages/product/configuration/data-sources/aws-athena.mdx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ details.
6565

6666
## Environment Variables
6767

68-
| Environment Variable | Description | Possible Values | Required | [Supports multiple data sources?][ref-config-multiple-ds-decorating-env] |
69-
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | :------: | :----------------------------------------------------------------------: |
70-
| `CUBEJS_AWS_KEY` | The AWS Access Key ID to use for database connections | A valid AWS Access Key ID |||
71-
| `CUBEJS_AWS_SECRET` | The AWS Secret Access Key to use for database connections | A valid AWS Secret Access Key |||
72-
| `CUBEJS_AWS_REGION` | The AWS region of the Cube deployment | [A valid AWS region][aws-docs-regions] |||
73-
| `CUBEJS_AWS_S3_OUTPUT_LOCATION` | The S3 path to store query results made by the Cube deployment | A valid S3 path |||
74-
| `CUBEJS_AWS_ATHENA_WORKGROUP` | The name of the workgroup in which the query is being started | [A valid Athena Workgroup][aws-athena-workgroup] |||
75-
| `CUBEJS_AWS_ATHENA_CATALOG` | The name of the catalog to use by default | [A valid Athena Catalog name][awsdatacatalog] |||
76-
| `CUBEJS_DB_SCHEMA` | The name of the schema to use as `information_schema` filter. Reduces count of tables loaded during schema generation. | A valid schema name |||
77-
| `CUBEJS_CONCURRENCY` | The number of concurrent connections each queue has to the database. Default is `5` | A valid number |||
68+
| Environment Variable | Description | Possible Values | Required |
69+
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | :------: |
70+
| `CUBEJS_AWS_KEY` | The AWS Access Key ID to use for database connections | A valid AWS Access Key ID ||
71+
| `CUBEJS_AWS_SECRET` | The AWS Secret Access Key to use for database connections | A valid AWS Secret Access Key ||
72+
| `CUBEJS_AWS_REGION` | The AWS region of the Cube deployment | [A valid AWS region][aws-docs-regions] ||
73+
| `CUBEJS_AWS_S3_OUTPUT_LOCATION` | The S3 path to store query results made by the Cube deployment | A valid S3 path ||
74+
| `CUBEJS_AWS_ATHENA_WORKGROUP` | The name of the workgroup in which the query is being started | [A valid Athena Workgroup][aws-athena-workgroup] ||
75+
| `CUBEJS_AWS_ATHENA_CATALOG` | The name of the catalog to use by default | [A valid Athena Catalog name][awsdatacatalog] ||
76+
| `CUBEJS_DB_SCHEMA` | The name of the schema to use as `information_schema` filter. Reduces count of tables loaded during schema generation. | A valid schema name ||
77+
| `CUBEJS_CONCURRENCY` | The number of concurrent connections each queue has to the database. Default is `5` | A valid number ||
7878

7979
## Pre-Aggregation Feature Support
8080

@@ -159,8 +159,6 @@ connections are made over HTTPS.
159159
/product/caching/using-pre-aggregations#export-bucket
160160
[ref-caching-using-preaggs-build-strats]:
161161
/product/caching/using-pre-aggregations#pre-aggregation-build-strategies
162-
[ref-config-multiple-ds-decorating-env]:
163-
/product/configuration/advanced/multiple-data-sources#configuring-data-sources-with-environment-variables-decorated-environment-variables
164162
[ref-schema-ref-types-formats-countdistinctapprox]:
165163
/reference/data-model/types-and-formats#count_distinct_approx
166164
[self-preaggs-batching]: #batching

docs/pages/product/configuration/data-sources/aws-redshift.mdx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ details.
7171

7272
## Environment Variables
7373

74-
| Environment Variable | Description | Possible Values | Required | [Supports multiple data sources?][ref-config-multiple-ds-decorating-env] |
75-
| -------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------- | :------: | :----------------------------------------------------------------------: |
76-
| `CUBEJS_DB_HOST` | The host URL for a database | A valid database host URL |||
77-
| `CUBEJS_DB_PORT` | The port for the database connection | A valid port number |||
78-
| `CUBEJS_DB_NAME` | The name of the database to connect to | A valid database name |||
79-
| `CUBEJS_DB_USER` | The username used to connect to the database | A valid database username |||
80-
| `CUBEJS_DB_PASS` | The password used to connect to the database | A valid database password |||
81-
| `CUBEJS_DB_SSL` | If `true`, enables SSL encryption for database connections from Cube | `true`, `false` |||
82-
| `CUBEJS_CONCURRENCY` | The number of concurrent connections each queue has to the database. Default is `4` | A valid number |||
83-
| `CUBEJS_DB_MAX_POOL` | The maximum number of concurrent database connections to pool. Default is `16` | A valid number |||
84-
| `CUBEJS_DB_EXPORT_BUCKET_REDSHIFT_ARN` | | |||
74+
| Environment Variable | Description | Possible Values | Required |
75+
| -------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------- | :------: |
76+
| `CUBEJS_DB_HOST` | The host URL for a database | A valid database host URL ||
77+
| `CUBEJS_DB_PORT` | The port for the database connection | A valid port number ||
78+
| `CUBEJS_DB_NAME` | The name of the database to connect to | A valid database name ||
79+
| `CUBEJS_DB_USER` | The username used to connect to the database | A valid database username ||
80+
| `CUBEJS_DB_PASS` | The password used to connect to the database | A valid database password ||
81+
| `CUBEJS_DB_SSL` | If `true`, enables SSL encryption for database connections from Cube | `true`, `false` ||
82+
| `CUBEJS_CONCURRENCY` | The number of concurrent connections each queue has to the database. Default is `4` | A valid number ||
83+
| `CUBEJS_DB_MAX_POOL` | The maximum number of concurrent database connections to pool. Default is `16` | A valid number ||
84+
| `CUBEJS_DB_EXPORT_BUCKET_REDSHIFT_ARN` | | ||
8585

8686
## Pre-Aggregation Feature Support
8787

@@ -158,8 +158,6 @@ Database][ref-recipe-enable-ssl].
158158
/product/caching/using-pre-aggregations#export-bucket
159159
[ref-caching-using-preaggs-build-strats]:
160160
/product/caching/using-pre-aggregations#pre-aggregation-build-strategies
161-
[ref-config-multiple-ds-decorating-env]:
162-
/product/configuration/advanced/multiple-data-sources#configuring-data-sources-with-environment-variables-decorated-environment-variables
163161
[ref-recipe-enable-ssl]:
164162
/guides/recipes/data-sources/using-ssl-connections-to-data-source
165163
[ref-schema-ref-types-formats-countdistinctapprox]:

0 commit comments

Comments
 (0)