Back to Cube

Semantic Layer Sync with Preset

docs-mintlify/docs/integrations/semantic-layer-sync/preset.mdx

1.6.431.9 KB
Original Source

This page details the support for Preset in Semantic Layer Sync.

Configuration

To create a new sync, choose Preset:

<Frame> </Frame>

Data model is synchronized via Preset API which uses API keys for authentication.

You can generate a new API key in your user settings in Preset to obtain an api_token and an api_secret. You can also copy a workspace_url at any page of your Preset workspace. Note that your use should have the workspace role of Workspace Admin.

Example confguration for Preset:

<CodeGroup>
python
from cube import config

@config('semantic_layer_sync')
def semantic_layer_sync(ctx: dict) -> list[dict]:
  return [
    {
      'type': 'preset',
      'name': "Preset Sync",
      'config': {
        'api_token': '07988f63-c200-499e-97c9-ba137d8918aa',
        'api_secret': 'c19fbab4fd4945899795d32898f2e1165bef8e5ee653499e92f083b3d088aecb',
        'workspace_url': '12345678.us1a.app.preset.io',
        'database': 'Cube Cloud: production-deployment'
      }
    }
  ]
javascript
module.exports = {
  semanticLayerSync: ({ securityContext }) => {
    return [
      {
        type: "preset",
        name: "Preset Sync",
        config: {
          api_token: "07988f63-c200-499e-97c9-ba137d8918aa",
          api_secret: "c19fbab4fd4945899795d32898f2e1165bef8e5ee653499e92f083b3d088aecb",
          workspace_url: "12345678.us1a.app.preset.io",
          database: "Cube Cloud: production-deployment"
        }
      }
    ]
  }
}
</CodeGroup>