diff --git a/guides/developer/preview-projects.mdx b/guides/developer/preview-projects.mdx index 605c2361..6ac1255e 100644 --- a/guides/developer/preview-projects.mdx +++ b/guides/developer/preview-projects.mdx @@ -193,6 +193,23 @@ lightdash preview --name "PR: Add Revenue Metric" lightdash preview --name "Long-lived preview" --expires-in 240 ``` +### Refreshing expiration on an existing preview + +Re-running `lightdash start-preview` with the same `--name` as an existing preview refreshes its expiration. `expires_at` is recomputed from the moment of the re-run using the same rules as a fresh preview — bounded by the upstream project's default and maximum. + +Omitting `--expires-in` on a re-run resets the expiration to the upstream project's default, since a re-run is treated as confirmation that the preview is still in use. + +```bash +# First run: creates the preview and sets expires_at based on the upstream default +lightdash start-preview --name "ecom-shop-analytics" + +# Later re-run without --expires-in: resets expires_at to the upstream default from now +lightdash start-preview --name "ecom-shop-analytics" + +# Re-run with an explicit value: sets expires_at to 72 hours from now (capped at the maximum) +lightdash start-preview --name "ecom-shop-analytics" --expires-in 72 +``` + ## Deleting a Preview Project Preview projects created using any method can be deleted in the [Lightdash App](/guides/developer/preview-projects#lightdash-app-2). diff --git a/references/lightdash-cli.mdx b/references/lightdash-cli.mdx index a1069510..fb17201b 100644 --- a/references/lightdash-cli.mdx +++ b/references/lightdash-cli.mdx @@ -391,6 +391,10 @@ All standard [dbt options](#dbt-options) work with `lightdash start-preview`. - (default: false) - Snowflake only. Disable converting timestamps to UTC. Applied and persisted when creating the preview project. When updating an existing preview, the flag is ignored with a warning and the saved project setting is used instead. + + **Re-running `lightdash start-preview` refreshes the expiration.** If the named preview already exists, `expires_at` is recomputed from the moment of the re-run using the same rules as a fresh preview (bounded by the upstream project's default and maximum). Omitting `--expires-in` on a re-run resets the expiration to the upstream project's default — a re-run is treated as confirmation that the preview is still in use. + + ### `lightdash stop-preview`