Skip to content

Commit 1b87ba8

Browse files
authored
docs: Running syncs on schedule in Semantic Layer Sync (#8154)
1 parent baf2667 commit 1b87ba8

File tree

2 files changed

+84
-6
lines changed

2 files changed

+84
-6
lines changed

docs/pages/product/deployment/cloud/auto-suspension.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ When a deployment is auto-suspended:
5858
API instances are de-provisioned.
5959
- [Refresh worker][ref-refresh-worker] is suspended, which stops pre-aggregation
6060
builds and prevents the pre-aggregations from being kept up-to-date.
61+
- [Semantic Layer Sync][ref-sls] is suspended, which prevents scheduled syncs
62+
from running.
6163
- [Monitoring integrations][ref-monitoring] are also suspended, which prevents
6264
the export of metrics and logs.
6365

@@ -126,3 +128,4 @@ response times to be significantly longer than usual.
126128
[ref-multitenancy]: /product/configuration/advanced/multitenancy
127129
[self-effects]: #effects-on-experience
128130
[ref-refresh-worker]: /product/deployment#refresh-worker
131+
[ref-sls]: /product/workspace/semantic-layer-sync#on-schedule

docs/pages/product/workspace/semantic-layer-sync.mdx

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,17 @@ module.exports = {
276276

277277
## Running syncs
278278

279+
Cube automatically runs configured syncs every time a [new build is deployed](#on-build).
280+
Additionally, you can configure syncs to run [on schedule](#on-schedule).
281+
Finally, you can [manually](#manually) trigger any sync to run.
282+
283+
During the sync, Cube will either create from scratch or update a database in
284+
the corresponding BI tool and the data model associated with it. Syncing a
285+
branch in [development mode][ref-dev-mode] will create a separate database,
286+
leaving the one associated with the production branch intact.
287+
288+
### On build
289+
279290
When the data model is updated, all configured syncs will automatically run.
280291

281292
<WarningBox>
@@ -288,17 +299,80 @@ data model is updated dynamically for your Cube Cloud account.
288299

289300
</WarningBox>
290301

302+
### On schedule
303+
304+
You can use the `scheduleInterval` option to specify the interval for running
305+
a particular sync on schedule. This is useful for cases when you expect that
306+
a BI tool might be temporarily unavailable via its API; the next scheduled sync
307+
will likely succeed anyway.
308+
309+
<CodeTabs>
310+
311+
```python
312+
from cube import config
313+
314+
@config('semantic_layer_sync')
315+
def semantic_layer_sync(ctx: dict) -> list[dict]:
316+
return [
317+
{
318+
'type': 'superset',
319+
'name': 'Superset Sync',
320+
'active': False,
321+
'config': {
322+
'user': '[email protected]',
323+
'password': '4dceae-606a03-93ae6dc7',
324+
'url': 'superset.example.com',
325+
'database': 'Cube Cloud: staging-deployment',
326+
'scheduleInterval': 'every 10 minutes'
327+
}
328+
}
329+
]
330+
```
331+
332+
```javascript
333+
module.exports = {
334+
semanticLayerSync: ({ securityContext }) => {
335+
return [
336+
{
337+
type: "superset",
338+
name: "Superset Sync",
339+
active: false,
340+
config: {
341+
342+
password: "4dceae-606a03-93ae6dc7",
343+
url: "superset.example.com",
344+
database: "Cube Cloud: staging-deployment",
345+
scheduleInterval: "every 10 minutes"
346+
}
347+
}
348+
]
349+
}
350+
}
351+
```
352+
353+
</CodeTabs>
354+
355+
The `scheduleInterval` option accepts values in the `every [number] [period]`
356+
format, where `[number]` can be any positive integer, and `[period]` can be
357+
any value from the following list: `day`, `hour`, `minute`, or `days`, `hours`,
358+
`minutes`.
359+
360+
<InfoBox>
361+
362+
Development instances and [auto-suspended][ref-auto-sus] production clusters
363+
can't run syncs on schedule.
364+
365+
</InfoBox>
366+
367+
### Manually
368+
291369
You can also run a sync manually by navigating to the <Btn>Semantic Layer
292370
Sync</Btn> tab on the <Btn>BI Integrations</Btn> page and clicking <Btn>Start
293-
Sync</Btn> next to a relevant sync.
371+
Sync</Btn> next to a relevant sync. This is convenient for working in the
372+
[development mode][ref-dev-mode].
294373

295374
<Screenshot src="https://ucarecdn.com/e48cef02-cc89-466d-a293-11a04aacb116/" />
296375

297-
During the sync, Cube will either create from scratch or update a database in
298-
the corresponding BI tool and the data model associated with it. Syncing a
299-
branch in [development mode][ref-dev-mode] will create a separate database,
300-
leaving the one associated with the production branch intact.
301-
302376
## Viewing history
303377

304378
You can view the history of runs for a particular sync by navigating to
@@ -328,3 +402,4 @@ on, i.e., your development mode branch, shared branch, or main branch.
328402
[ref-config-schemaversion]: /reference/configuration/config#schemaversion
329403
[ref-workspace-sls]: /workspace/bi-integrations
330404
[ref-dev-mode]: /product/workspace/dev-mode
405+
[ref-auto-sus]: /product/deployment/cloud/auto-suspension

0 commit comments

Comments
 (0)