Skip to content

Commit

Permalink
docs: how to connect to remote clickhouse
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Jul 25, 2023
1 parent 484c210 commit b3f6386
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 61 deletions.
6 changes: 3 additions & 3 deletions docs/concepts/authentication_permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ You can find more information about these roles in the
We do not use any of the provided roles, instead we have created custom roles for our specific
uses cases:

- **Admin**: Full access to all Superset data, dashboards, and reports.
- **Alpha**: Superusers of the LMS, have full access to Superset.
- **Admin**: Staff users of the LMS, have full access to Superset.
- **Operator**: Access to the operator dashboard and data about the state of the installation.
- **Instructor**: Access to the instructor dashboard and course specific data.

Expand Down Expand Up @@ -51,8 +52,7 @@ an instructor should only be able to see data for the courses they are teaching.

The following RLSF are implemented by default:

- **can_view_courses**: Return courses a user has access to.
- **can_view_courses**: Limits courses in the report to ones the user has access to.

RLSF can be extended and assigned using a combination of extensions described in
:ref:`extensions` docs.

59 changes: 2 additions & 57 deletions docs/concepts/clickhouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,9 @@ ClickHouse is a high-performance, column-oriented SQL database management system
for online analytical processing (OLAP). It is used as the backend storage for the Aspects
project that powers Superset.

Connect to Clickhouse Cloud
***************************
Aspects is compatible with Clickhouse Cloud and on premise Clickhouse instances.

Aspects can be connected with Clickhouse Cloud following the steps below:


1. Disable the Clickhouse service:

.. code-block:: yaml
RUN_CLICKHOUSE: false
2. Create a Clickhouse Cloud account and a cluster, and get the credentials.

3. Once you get the credentials, set the following variables in your **config.yaml** file:

.. code-block:: yaml
CLICKHOUSE_HOST: <clickhouse_host>
CLICKHOUSE_SECURE_CONNECTION: true
CLICKHOUSE_ADMIN_USER: <clickhouse_admin_user>
CLICKHOUSE_ADMIN_PASSWORD: <clickhouse_admin_password>
4. Apply the changes by running the following command:

.. code-block:: bash
tutor config save
5. Restart your local or production environment. After this change, you need to run the initialization
tasks. To do so, run the following command according to your environment:

.. code-block:: bash
tutor [local|dev|k8s] do init -l aspects
Connect to on Premise Clickhouse
********************************

Aspects provide several configuration parameters that can be customized to connect to an on premise
Clickhouse instance. To do so, set the following variables in your **config.yaml** file:

.. code-block:: yaml
CLICKHOUSE_HOST: <clickhouse_host>
CLICKHOUSE_SECURE_CONNECTION: true|false
CLICKHOUSE_ADMIN_USER: <clickhouse_admin_user>
CLICKHOUSE_ADMIN_PASSWORD: <clickhouse_admin_password>
CLICKHOUSE_CLIENT_PORT: <clickhouse_client_port> # default to 9000 | 9440 used by initialization tasks
CLICKHOUSE_PORT: <clickhouse_port> # default to 8123 | 8443 used by other services such as ralph and the lms
Additionally, there are some other variables that are calculated based on the above variables, but
can be customized if needed:

.. code-block:: yaml
CLICKHOUSE_REPORT_SQLALCHEMY_URI: <clickhouse_url> # used by superset to perform queries
CLICKHOUSE_ADMIN_SQLALCHEMY_URI: <clickhouse_url> # used by initialization tasks to create tables and views
See :ref:`remote-clickhouse` for more information.

Clickhouse Migrations
****************************
Expand Down
3 changes: 2 additions & 1 deletion docs/how-tos/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ How-Tos
Superset extra jinja filters <superset_jinja_filters>
Superset custom roles <superset_roles>
Clickhouse extra SQL <clickhouse_sql>
Extending DBT <dbt_extensions>
Connect to external Clickhouse database <remote_clickhouse>
Extending DBT <dbt_extensions>
63 changes: 63 additions & 0 deletions docs/how-tos/remote_clickhouse.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.. _remote-clickhouse:

Connect to external Clickhouse database
***************************************

Connect to Clickhouse Cloud
###########################

Aspects can be connected with Clickhouse Cloud following the steps below:


1. Disable the Clickhouse service:

.. code-block:: yaml
RUN_CLICKHOUSE: false
2. Create a Clickhouse Cloud account and a cluster, and get the credentials.

3. Once you get the credentials, set the following variables in your **config.yaml** file:

.. code-block:: yaml
CLICKHOUSE_HOST: <clickhouse_host>
CLICKHOUSE_SECURE_CONNECTION: true
CLICKHOUSE_ADMIN_USER: <clickhouse_admin_user>
CLICKHOUSE_ADMIN_PASSWORD: <clickhouse_admin_password>
4. Apply the changes by running the following command:

.. code-block:: bash
tutor config save
5. Restart your local or production environment. After this change, you need to run the initialization
tasks. To do so, run the following command according to your environment:

.. code-block:: bash
tutor [local|dev|k8s] do init -l aspects
Connect to on Premise Clickhouse
################################

Aspects provide several configuration parameters that can be customized to connect to an on premise
Clickhouse instance. To do so, set the following variables in your **config.yaml** file:

.. code-block:: yaml
CLICKHOUSE_HOST: <clickhouse_host>
CLICKHOUSE_SECURE_CONNECTION: true|false
CLICKHOUSE_ADMIN_USER: <clickhouse_admin_user>
CLICKHOUSE_ADMIN_PASSWORD: <clickhouse_admin_password>
CLICKHOUSE_CLIENT_PORT: <clickhouse_client_port> # default to 9000 | 9440 used by initialization tasks
CLICKHOUSE_PORT: <clickhouse_port> # default to 8123 | 8443 used by other services such as ralph and the lms
Additionally, there are some other variables that are calculated based on the above variables, but
can be customized if needed:

.. code-block:: yaml
CLICKHOUSE_REPORT_SQLALCHEMY_URI: <clickhouse_url> # used by superset to perform queries
CLICKHOUSE_ADMIN_SQLALCHEMY_URI: <clickhouse_url> # used by initialization tasks to create tables and views

0 comments on commit b3f6386

Please sign in to comment.