Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports = {

Now, you can use the `securityContext` in your data model:

```twig filename="model/cubes/users.yml.jinja"
```twig filename="model/cubes/users.yml"
{# Is the current team trusted? #}
{% set trusted_teams = ['cx', 'exec' ] %}
{% set is_trusted_team = COMPILE_CONTEXT.securityContext.team in trusted_teams %}
Expand Down
18 changes: 12 additions & 6 deletions docs/docs-new/pages/product/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,8 @@ Both ways are equivalent; when in doubt, use Python.

Support for Python and the `cube.py` file was introduced in v0.34.

As of v0.34, Cube uses Node 16.20 to execute JavaScript-based
configuration and Python 3.9 for Python-based configuration.

</InfoBox>

When Cube starts, it will install dependencies in `package.json` via `yarn`
and dependencies in `requirements.txt` via `pip`.

### Cube Core

When using Docker, ensure that the configuration file and your [data model
Expand All @@ -126,6 +120,18 @@ Docker container.
You can edit the configuration file by going into <Btn>Development Mode</Btn>
and navigating to the <Btn>Data Model</Btn> page.

## Runtime and dependencies

As of v0.34, Cube uses Node.js v16.20 to execute JavaScript-based
configuration and Python v3.9 for Python-based configuration.

If you have dependencies in `requirements.txt` file, make sure to install
them by running `pip install -r requirements.txt` inside the container.

If you have dependencies in `package.json` file, make sure to install them
by running `yarn` and mount the `node_modules` folder under `/cube/conf`
in the Docker container.

## Development Mode

Cube can be run in an insecure, development mode by setting the
Expand Down
8 changes: 5 additions & 3 deletions docs/docs-new/pages/product/data-modeling/dynamic/jinja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Cube supports authoring dynamic data models using the [Jinja templating
language][jinja] and Python. This allows de-duplicating common patterns in your data models
as well as dynamically generating data models from a remote data source.

To use a Jinja template, create a file in your data model folder with the
`.jinja` extension. For example, a file containing the `orders` cube could be
named `orders.yml.jinja` under the `models/` directory.
Jinja is supported in all YAML data model files.

## Jinja

Please check the [Jinja documentation][jinja-docs] for details on Jinja syntax.

### Loops

Jinja supports [looping][jinja-docs-for-loop] over lists and dictionaries. In
Expand Down Expand Up @@ -196,6 +197,7 @@ cubes:
```

[jinja]: https://jinja.palletsprojects.com/
[jinja-docs]: https://jinja.palletsprojects.com/en/3.1.x/templates/
[jinja-docs-for-loop]: https://jinja.palletsprojects.com/en/3.1.x/templates/#for
[jinja-docs-macros]:
https://jinja.palletsprojects.com/en/3.1.x/templates/#macros
1 change: 1 addition & 0 deletions docs/docs-new/pages/reference/python/_meta.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
"cube": "cube",
"cube_dbt": "cube_dbt",
"lkml2cube": "lkml2cube",
}
79 changes: 79 additions & 0 deletions docs/docs-new/pages/reference/python/lkml2cube.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# `lkml2cube` package

`lkml2cube` package facilitates the migration from [Looker][link-looker]
to Cube. It provides a convenient command-line tool for converting
[LookML][link-lookml] models into the Cube data model.

* Install [`lkml2cube`][link-lkml2cube-pypi] package from PyPI
* Check the source code in [`lkml2cube`][link-lkml2cube-repo] on GitHub
* Submit issues to [`cube`][link-cube-repo-issues] on GitHub

## Installation

Run the following command:

```bash
pip install lkml2cube
```

## Usage

There are two commands: `cubes` and `views`. Both commands read all the
files in the provided input parameter, including those referenced by the
LookML keyword `include`.

### `cubes`

The `cubes` command would inspect LookML [views][link-lookml-views] and
generate [cubes][ref-cubes].

Since join relationships are defined at the `explore` level in LookML
syntax, generated cubes would not have [join][ref-joins] definitions.

#### Debugging

Run the following command to display a representation of a LookML object
as a Python dictionary:

```bash
lkml2cube cubes --parseonly path/to/file.view.lkml
```

#### Converting

Run the following command to convert LookML [views][link-lookml-views]
into [cubes][ref-cubes]:

```bash
lkml2cube cubes path/to/file.view.lkml --outputdir ./
```

### `views`

The `views` command would inspect LookML [explores][link-lookml-explores]
and generate [cubes][ref-cubes] and [views][ref-views].

Since join relationships are defined at the `explore` level in LookML
syntax, generated cubes and views would have [join][ref-joins] definitions.

#### Converting

Run the following command to convert LookML [explores][link-lookml-explores]
into [cubes][ref-cubes] and [views][ref-views]:

```bash
lkml2cube views path/to/file.explore.lkml --outputdir ./
```


[link-looker]: https://cloud.google.com/looker/
[link-lookml]: https://cloud.google.com/looker/docs/reference/lookml-quick-reference
[link-lookml-views]: https://cloud.google.com/looker/docs/reference/param-view
[link-lookml-explores]: https://cloud.google.com/looker/docs/reference/param-explore
[link-lkml2cube-repo]: https://github.com/cube-js/lkml2cube
[link-lkml2cube-pypi]: https://pypi.org/project/lkml2cube/
[link-cube-repo-issues]: https://github.com/cube-js/cube/issues

[ref-cubes]: /reference/data-model/cube
[ref-views]: /reference/data-model/view
[ref-joins]: /reference/data-model/joins
5 changes: 5 additions & 0 deletions docs/docs-new/redirects.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[
{
"source": "/product/data-modeling/fundamentals/additional-concepts",
"destination": "/product/data-modeling/concepts/subquery-dimensions",
"permanent": true
},
{
"source": "/product/data-modeling/advanced/using-dbt",
"destination": "/guides/dbt",
Expand Down