> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cube as a data source

> Bring data from Cube to Nekt.

[Cube](https://cube.dev) is a semantic layer that sits in front of a data warehouse or database, letting teams model "cubes" of measures and dimensions on top of their data. This connector is fully generic: it has no knowledge of any specific data model, and instead discovers a client's cubes and views at runtime, from whichever Cube Core or Cube Cloud deployment it's pointed at.

<img height="50" src="https://mintcdn.com/nekt/GyQ7uUIAjG9a740n/assets/logo/logo-cube.png?fit=max&auto=format&n=GyQ7uUIAjG9a740n&q=85&s=cbaa47f129f7e02853ffb2a76d9b86c8" data-path="assets/logo/logo-cube.png" />

## Configuring Cube as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Cube option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

Cube exposes two separate APIs, and this connector needs credentials for both: the **Meta API** (used to discover the data model) and the **SQL API** (used to extract data).

The following configurations are available:

* **Meta API Base URL**: Base URL of Cube's REST API, used for schema discovery. For example, `https://my-deployment.cubecloudapp.dev` for Cube Cloud, or `http://localhost:4000` for a self-hosted Cube Core. Do not include the `/cubejs-api/v1/meta` suffix.

* **Authorization Header**: Value sent as the `Authorization` header when calling the Meta API. Use the raw Cube API token, or `Bearer <token>` if your deployment issues a JWT that requires the Bearer scheme.

* **SQL API Host**: Hostname of Cube's SQL API (Postgres-compatible protocol). For Cube Cloud, this is a different host than the Meta API's, typically something like `my-deployment.sql.gcp-us-central1.cubecloudapp.dev`.

* **SQL API Port**: (Optional, default `5432`) Port of Cube's SQL API. Self-hosted Cube Core deployments set this via `CUBEJS_PG_SQL_PORT` and commonly use a different port.

* **Database**: (Optional, default `cube`) Database name for the SQL API connection. Cube accepts any non-empty string here — it doesn't correspond to a real database.

* **SQL API User**: Username for the SQL API connection (`CUBEJS_SQL_USER`).

* **SQL API Password**: Password for the SQL API connection (`CUBEJS_SQL_PASSWORD`).

* **Use SSL**: (Optional, default enabled) Whether to require SSL for the SQL API connection.

* **Start Date**: (Optional) Earliest value to sync for cubes that expose a time dimension. Cubes without a time dimension are always synced in full.

<Note>Cube Cloud typically serves the Meta API and SQL API on different hosts — make sure you provide the SQL-specific host, not the Meta API's.</Note>

Once you're done, click **Next**.

### 2. Select streams

The connector automatically discovers every cube and view exposed by the Meta API. Choose which ones you want to sync.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer, a folder to organize it, a name for each table, and the type of sync.

<Note>
  Sync type is decided automatically per cube, not configured manually: cubes with a `time`-typed dimension sync **incrementally** on that dimension; cubes without one sync as **full table**.
</Note>

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization.

Define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers) based on how often you need data updated.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button.

<Warning>For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.</Warning>

## Streams and Fields

Cube is a semantic-layer connector — streams are dynamically discovered from your Cube deployment's own data model. Each cube or view becomes a stream, with one field per measure and dimension it defines.

### Supported Data Types

| Cube Type | Mapped Type |
| --------- | ----------- |
| string    | String      |
| number    | Number      |
| boolean   | Boolean     |
| time      | DateTime    |

### Primary Keys and Replication

* **Primary key**: Cube's Meta API doesn't expose an explicit primary-key flag for regular cubes, so the full set of dimensions is used as the primary key — every row is a `GROUP BY` of all dimensions, so that combination is the row's natural key.
* **Replication**: If a cube has a `time`-typed dimension, it's synced incrementally, filtered on that dimension using the **Start Date** (or the bookmark from a previous run). Cubes without a time dimension are always synced in full.

<Note>
  Data freshness for incremental streams also depends on the cube's own pre-aggregation refresh configuration on the Cube deployment itself — this connector has no control over that.
</Note>

## Known Limitations

* Cube's SQL API decides on its own, per query, whether to answer from cache/pre-aggregations or push the query down to the underlying data source. This connector sends plain, portable SQL and does not force or detect either path.
* Cube Cloud's separate Metadata API exposes richer schema information (an explicit primary-key flag, table lineage), but it requires a JWT obtained through the Cube Cloud Control Plane API and is Cube-Cloud-only. It is not used, so that discovery behaves identically on Cube Core and Cube Cloud.
* Very large result sets may require Cube's `CUBESQL_STREAM_MODE` to be enabled on the deployment side.
