Skip to content

Commit

Permalink
docs: Clean up, replace outdated "schema" wording with "data model"
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlukanin committed Dec 10, 2024
1 parent 47c3638 commit 215e456
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ statuses from an external API. To calculate the orders percentage distribution,
we need to create several
[measures](/product/data-modeling/concepts#measures) that refer to
each other. But we don't want to manually change the data model for each new
status. To solve this, we will create a
[schema dynamically](/product/data-modeling/dynamic).
status. To solve this, we will create a [data model
dynamically](/product/data-modeling/dynamic).

## Data modeling

Expand Down
4 changes: 2 additions & 2 deletions docs/pages/product/apis-integrations/semantic-layer-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ When the data model is updated, all configured syncs will automatically run.
<WarningBox>

If data model is updated dynamically and the
[`schemaVersion`][ref-config-schemaversion] configuration option is used to
[`schema_version`][ref-config-schemaversion] configuration option is used to
track data model changes, syncs will not automatically run. This behavior is
disabled by default. Please contact support to enable running syncs when the
data model is updated dynamically for your Cube Cloud account.
Expand Down Expand Up @@ -399,7 +399,7 @@ on, i.e., your development mode branch, shared branch, or main branch.
[ref-config-file]: /product/configuration#configuration-options
[ref-config-sls]: /reference/configuration/config#semanticlayersync
[ref-config-contexts]: /reference/configuration/config#scheduledrefreshcontexts
[ref-config-schemaversion]: /reference/configuration/config#schemaversion
[ref-config-schemaversion]: /reference/configuration/config#schema_version
[ref-workspace-sls]: /workspace/bi-integrations
[ref-dev-mode]: /product/workspace/dev-mode
[ref-auto-sus]: /product/deployment/cloud/auto-suspension
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ several orders of magnitude, and ensures subsequent queries can be served by the
same condensed dataset if any matching attributes are found.

[Pre-aggregations are defined within each cube's data
schema][ref-schema-preaggs], and cubes can have as many pre-aggregations as they
model][ref-schema-preaggs], and cubes can have as many pre-aggregations as they
require. The pre-aggregated data is stored in [Cube Store, a dedicated pre-aggregation storage
layer][ref-caching-preaggs-cubestore].

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/product/caching/matching-pre-aggregations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ checked for additivity.
- **Does every member of the query exist in the pre-aggregation?** Cube checks
that the pre-aggregation contains all dimensions, filter dimensions, and leaf
measures from the query.
- **Are any query measures multiplied in the cube's data schema?** Cube checks
- **Are any query measures multiplied in the cube's data model?** Cube checks
if any measures are multiplied via a [`one_to_many`
relationship][ref-schema-joins-rel] between cubes in the query.
- **Does the query specify granularity for its time dimension?** Cube checks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ some tables:

To query your data, go to the&nbsp;<Btn>Dashboards</Btn> page and
click&nbsp;<Btn>Create Dashboard</Btn>. Proceed with adding a new dataset
to this dashboard by clicking&nbsp;<Btn>+</Btn> (choose the schema you've
to this dashboard by clicking&nbsp;<Btn>+</Btn> (choose the data model you've
created just a few minutes ago):

<Screenshot src="https://ucarecdn.com/d57adb21-9af8-4446-b5cd-296ebe5c912e/"/>
Expand Down
24 changes: 12 additions & 12 deletions docs/pages/product/data-modeling/dynamic/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ For similar functionality in YAML, see [Dynamic data models with Jinja and Pytho
</InfoBox>

Cube allows data models to be created on-the-fly using a special
[`asyncModule()`][ref-async-module] function only available in the [schema
execution environment][ref-schema-env]. `asyncModule()` allows registering an
[`asyncModule()`][ref-async-module] function only available in the
[execution environment][ref-schema-env]. `asyncModule()` allows registering an
async function to be executed at the end of the data model compile phase so
additional definitions can be added. This is often useful in situations where
schema properties can be dynamically updated through an API, for example.
data model properties can be dynamically updated through an API, for example.

<WarningBox>

Expand Down Expand Up @@ -91,7 +91,7 @@ generate data models from that data:
/product/data-modeling/dynamic/schema-execution-environment#cube-js-globals-cube-and-others

```javascript
// model/cubes/DynamicSchema.js
// model/cubes/DynamicDataModel.js
const fetch = require("node-fetch");
import {
convertStringPropToFunction,
Expand Down Expand Up @@ -144,10 +144,10 @@ asyncModule(async () => {
});
```

## Usage with schemaVersion
## Usage with `schema_version`

It is also useful to be able to recompile the data model when there are changes
in the underlying input data. For this purpose, the [`schemaVersion`
in the underlying input data. For this purpose, the [`schema_version`
][link-config-schema-version] value in the `cube.js` configuration options can
be specified as an asynchronous function:

Expand All @@ -156,26 +156,26 @@ be specified as an asynchronous function:
module.exports = {
schemaVersion: async ({ securityContext }) => {
const schemaVersions = await (
await fetch("http://your-api-endpoint/schemaVersion")
await fetch("http://your-api-endpoint/schema_version")
).json();

return schemaVersions[securityContext.tenantId];
},
};
```

[link-config-schema-version]: /reference/configuration/config#schemaversion
[link-config-schema-version]: /reference/configuration/config#schema_version

## Usage with COMPILE_CONTEXT

The `COMPILE_CONTEXT` global object can also be used in conjunction with async
schema creation to allow for multi-tenant deployments of Cube.
data model creation to allow for multi-tenant deployments of Cube.

In an example scenario where all tenants share the same cube, but see different
dimensions and measures, you could do the following:

```javascript
// model/cubes/DynamicSchema.js
// model/cubes/DynamicDataModel.js
const fetch = require("node-fetch");
import {
convertStringPropToFunction,
Expand Down Expand Up @@ -223,7 +223,7 @@ asyncModule(async () => {

When using multiple databases, you'll need to ensure you set the
[`data_source`][ref-schema-datasource] property for any asynchronously-created
schemas, as well as ensuring the corresponding database drivers are set up with
data models, as well as ensuring the corresponding database drivers are set up with
[`driverFactory()`][ref-config-driverfactory] in your [`cube.js` configuration
file][ref-config].

Expand All @@ -235,7 +235,7 @@ For an example scenario where data models may use either MySQL or Postgres
databases, you could do the following:

```javascript
// model/cubes/DynamicSchema.js
// model/cubes/DynamicDataModel.js
const fetch = require("node-fetch");
import {
convertStringPropToFunction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ cube(`users`, {
Data models cannot access `console.log` due to a separate [VM
instance][nodejs-vm] that runs it. Suppose you find yourself writing complex
logic for SQL generation that depends on a lot of external input. In that case,
you probably want to introduce a helper service outside of `schema` directory
that you can debug as usual Node.js code.
you probably want to introduce a helper service outside of the [data model
directory][ref-schema-path] that you can debug as usual Node.js code.

## Cube globals (cube and others)

Expand Down Expand Up @@ -109,8 +109,8 @@ cube(`users`, {
## asyncModule

Data models can be externally stored and retrieved through an asynchronous
operation using the `asyncModule()`. For more information, consult the [Dynamic
Schema Creation][ref-dynamic-schemas] page.
operation using the `asyncModule()`. For more information, consult the [dynamic
data model creation][ref-dynamic-schemas].

## Context symbols transpile

Expand Down Expand Up @@ -191,3 +191,4 @@ cube(`users`, {
[nodejs-require]: https://nodejs.org/api/modules.html#modules_require_id
[ref-dynamic-schemas]: /product/data-modeling/dynamic
[self-require]: #require
[ref-schema-path]: /reference/configuration/config#schema_path
4 changes: 2 additions & 2 deletions docs/pages/product/deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The [Cube Docker image][dh-cubejs] is used for API Instance.

API instances can be configured via environment variables or the `cube.js`
configuration file, and **must** have access to the data model files (as
specified by [`schemaPath`][ref-conf-ref-schemapath].
specified by [`schema_path`][ref-conf-ref-schemapath].

## Refresh Worker

Expand Down Expand Up @@ -256,5 +256,5 @@ services:
[ref-deploy-docker]: /product/deployment/core
[ref-config-env]: /reference/configuration/environment-variables
[ref-config-js]: /reference/configuration/config
[ref-conf-ref-schemapath]: /reference/configuration/config#schemapath
[ref-conf-ref-schemapath]: /reference/configuration/config#schema_path
[gh-pavel]: https://github.com/paveltiunov
4 changes: 2 additions & 2 deletions docs/pages/product/deployment/core.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ RUN npm install
And this to the `.dockerignore`:

```gitignore
schema
model
cube.py
cube.js
.env
Expand Down Expand Up @@ -371,7 +371,7 @@ installed with `npm install` reside, and result in errors like this:
```yaml
# ...
volumes:
- ./schema:/cube/conf/schema
- ./model:/cube/conf/model
- ./cube.js:/cube/conf/cube.js
# Other necessary files
```
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/product/workspace/rollup-designer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ clicking the ​<Btn>Settings</Btn> tab:

<Screenshot src="https://ucarecdn.com/27afed37-10ae-4948-bf3f-4261f6e0663c/" />

Click <Btn>Add to the Data Schema</Btn> to add the pre-aggregation to the data
Click <Btn>Add to the Data Model</Btn> to add the pre-aggregation to the data
model.

[ref-caching-preaggs-gs]: /product/caching/getting-started-pre-aggregations
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/reference/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Example of a Cube project with models that fail validation:

```bash{outputLines: 2-16}
npx cubejs-cli validate
❌ Cube Schema validation failed
❌ Cube Data Model validation failed
Cube Error ---------------------------------------
Expand Down

0 comments on commit 215e456

Please sign in to comment.