diff --git a/docs/docs-new/pages/product/apis-integrations/sql-api/security.mdx b/docs/docs-new/pages/product/apis-integrations/sql-api/security.mdx index 8248314fd4d7a..c0da85de511d9 100644 --- a/docs/docs-new/pages/product/apis-integrations/sql-api/security.mdx +++ b/docs/docs-new/pages/product/apis-integrations/sql-api/security.mdx @@ -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 %} diff --git a/docs/docs-new/pages/product/configuration.mdx b/docs/docs-new/pages/product/configuration.mdx index dabcf3e0c1ce4..bab6ccd155a8e 100644 --- a/docs/docs-new/pages/product/configuration.mdx +++ b/docs/docs-new/pages/product/configuration.mdx @@ -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. - -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 @@ -126,6 +120,18 @@ Docker container. You can edit the configuration file by going into Development Mode and navigating to the Data Model 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 diff --git a/docs/docs-new/pages/product/data-modeling/dynamic/jinja.mdx b/docs/docs-new/pages/product/data-modeling/dynamic/jinja.mdx index d9957e6358d59..02e61b893f443 100644 --- a/docs/docs-new/pages/product/data-modeling/dynamic/jinja.mdx +++ b/docs/docs-new/pages/product/data-modeling/dynamic/jinja.mdx @@ -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 @@ -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 diff --git a/docs/docs-new/pages/reference/python/_meta.js b/docs/docs-new/pages/reference/python/_meta.js index e7fc3ed0f026c..0afdd37172884 100644 --- a/docs/docs-new/pages/reference/python/_meta.js +++ b/docs/docs-new/pages/reference/python/_meta.js @@ -1,4 +1,5 @@ module.exports = { "cube": "cube", "cube_dbt": "cube_dbt", + "lkml2cube": "lkml2cube", } \ No newline at end of file diff --git a/docs/docs-new/pages/reference/python/lkml2cube.mdx b/docs/docs-new/pages/reference/python/lkml2cube.mdx new file mode 100644 index 0000000000000..87d9c9b0b2836 --- /dev/null +++ b/docs/docs-new/pages/reference/python/lkml2cube.mdx @@ -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 \ No newline at end of file diff --git a/docs/docs-new/redirects.json b/docs/docs-new/redirects.json index e0a5c1210d550..b119ad51620c1 100644 --- a/docs/docs-new/redirects.json +++ b/docs/docs-new/redirects.json @@ -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",