Skip to content

Adds schemaVersion for cube to automatically detect schema change

Surabhi Suman requested to merge update-cube-schema into main

What does this MR do and why?

Describe in detail what your merge request does and why.

Relates to gitlab-org/gitlab#460034 (closed)

How to set up and validate

  1. Run cube in production mode in a cluster. Upgrade the deployment by running helm upgrade -f custom.values.yaml [RELEASE_NAME]

  2. Create a new funnel or update existing funnel by making an api call to /funnel-schemas endpoint in analytics manager.

    POST http://{analytics-configurator-endpoint}/funnel-schemas
    Authorization: Basic [AUTH_USERNAME] [AUTH_PASSWORD]
    Content-Type: application/json
    
    {
      "project_ids": ["gitlab_project_#{id}"],
      "funnels": [
        {
          "name": "completed_purchase",
          "schema": "SELECT (SELECT max(derived_tstamp) FROM gitlab_project_#{id{.snowplow_events) as x, windowFunnel(3600)(toDateTime(derived_tstamp), page_urlpath = ''/page1.html'', page_urlpath = ''/page2.html'') as step FROM gitlab_project_#{id}.snowplow_events",
          "state": "created"
        }
      ]
    }

    OR

    Run GDK locally. Create a new funnel in any repository.

  3. Make an API call to cubejs /v1/meta endpoint to see the cube schema defined. It should have the new cube funnel schema definition.

  4. Try updating/deleting a funnel too. It should be reflected immediately in the cubes (/v1/meta) endpoint without a restart.

How to deploy upon merging

Numbered steps to explain how this change needs to be deployed to each environment.

Merge request reports