Introducing a new way to review your PRs.

Read the announcement

bruin-data / dac

DaC is a dashboard-as-code tool. Build interactive dashboards using YAML and JSX. Built-in semantic layer. Get your agents to build standardized, reviewable dashboards.

View on GitHub

20 documents · Updated Nov 23, 2026

docs / project-import-export

Project import and export conversion

DAC uses conversion paths to bring dashboard content from external tools into its declarative project model and to publish dashboard results in an external presentation format. The current paths are a Metabase importer, a Google Slides exporter, and a raw dashboard API view that preserves the source representation.

Conversion boundary

Conversion sits between an external document or service and the DAC dashboard model. The importer creates DAC assets that can be validated and loaded like other project files. The exporters start from that loaded model and produce a rendered or source-level representation.

DirectionSourceResultMain purpose
ImportMetabase dashboard response or live dashboardDAC dashboard YAML, with optional semantic model YAML filesMove a Metabase dashboard into a DAC project
ExportLoaded DAC dashboard and query resultsGoogle Slides presentationShare a dashboard as a static presentation
Source viewLoaded DAC dashboard fileOriginal YAML or TSX text over HTTPLet clients retrieve the authored representation

Conversion flow

The following flow shows how external dashboard content becomes project assets and how a loaded dashboard becomes a presentation.

flowchart LR
    M[Metabase response or API] --> I[Metabase importer]
    I --> D[DAC dashboard YAML]
    I --> S[Optional semantic model YAML]
    D --> L[DAC project loader]
    S --> L
    L --> Q[Dashboard queries and widget data]
    Q --> G[Google Slides exporter]
    G --> P[Google Slides presentation]

The paths are not a general lossless exchange format. Each adapter maps only the concepts that DAC can represent, and it reports or preserves gaps instead of claiming that every source feature has moved across unchanged. References: cmd/import.go• L19-158, cmd/export.go• L12-71, pkg/…/convert.go• L74-185, pkg/…/export.go• L46-146

Import adapters

An importer adapter translates one external product’s dashboard model into DAC dashboard concepts. The adapter owns source-specific rules so the rest of DAC receives normal dashboard assets rather than a second dashboard format.

Metabase input boundary

The Metabase adapter accepts either a saved dashboard API response in JSON or YAML or a live dashboard fetched from a Metabase service. A live import uses the dashboard response as its starting point and can fetch referenced source cards, metrics, and table metadata so query-builder content has enough context for conversion.

The command requires one input mode. File input is useful for repeatable imports and review. Live input needs both a service URL and a dashboard ID, plus an API key or session token.

References: cmd/import.go• L29-105 cmd/import.go• L163-230 cmd/import.go• L233-303 pkg/…/convert.go• L188-245

Metabase dashboard conversion

The adapter turns a Metabase dashboard into a DAC dashboard with its name, description, connection, filters, rows, and widgets. It preserves the dashboard layout at a compatible level and maps source cards to DAC data widgets such as metrics, charts, and tables.

Native SQL questions become SQL-backed widgets. Supported Metabase query-builder content, also called MBQL, becomes SQL when the source model or physical table data is available. The adapter also translates supported dashboard parameter mappings into DAC filter behavior, while unresolved or unsupported source features remain visible through warnings or placeholders.

Metabase contentDAC result
Dashboard parametersDashboard filters
Native SQL questionSQL-backed widget
Supported model or table queryGenerated SQL-backed widget
Scalar questionMetric widget
Chart questionChart widget
Table, pivot, or map questionTable widget
Text contentText widget
Unsupported cardText placeholder by default

The conversion also adapts SQL template variables and optional SQL clauses to DAC filter references. It warns when the source behavior needs review, because a generated query can be valid DAC SQL while still needing a human check for equivalent filter behavior.

References: pkg/…/convert.go• L86-185 pkg/…/convert.go• L343-439 pkg/…/convert.go• L521-785 pkg/…/convert.go• L1349-1470 pkg/…/convert.go• L1487-1568

Semantic project conversion

The semantic import mode produces a project result rather than only one dashboard document. A semantic model is a reusable description of data dimensions and named metrics. Explicit Metabase models become DAC semantic model files, and explicit Metabase metrics can become named metrics in those files.

Eligible model-backed cards can then point to those semantic models and metrics. Cards that use unnamed aggregations or unsupported semantic features stay SQL-backed unless strict semantic mode turns the gap into an error. This keeps the generated project usable without inventing durable names for source expressions that do not have them.

Generated semantic files are written to a sibling semantic/ directory by default. The normal project loader finds that directory next to dashboards/ and supplies its models as context when it loads the dashboard. References: cmd/import.go• L95-156, pkg/…/semantic.go• L14-161, pkg/…/semantic.go• L164-279, pkg/…/semantic.go• L814-825, pkg/…/project.go• L15-75, pkg/…/loader.go• L14-56

Import completeness

The importer favors an explicit result over silent loss. In normal mode, a card that DAC cannot represent becomes a text placeholder and adds a warning. Strict mode fails the import instead. Semantic strict mode applies the same fail-fast choice only to model-backed cards that cannot become semantic widgets.

The import report distinguishes total widgets from SQL-backed widgets, semantic widgets, and placeholders. This gives the engineer a quick check of how much of the source dashboard moved into active DAC behavior.

References: cmd/import.go• L69-83 cmd/import.go• L100-155 pkg/…/convert.go• L17-31 pkg/…/convert.go• L371-430

Dashboard export paths

Dashboard export starts with a DAC dashboard that has passed loading and validation. The exporter resolves the dashboard’s data work, runs the required queries with filters, and sends the resulting values to an external presentation service.

Google Slides presentation

The Google Slides adapter creates a presentation with a title slide and one content slide for each dashboard row. Metrics become formatted text, charts become images, and tables become native Slides tables. Text widgets are placed as text, while a widget with missing data can receive a visible placeholder.

The command accepts filter overrides that replace dashboard defaults for the export run. It returns the URL of the new presentation after the Slides and Drive services create and populate it.

References: cmd/export.go• L22-71 pkg/…/export.go• L36-146 pkg/…/export.go• L173-228 pkg/…/export.go• L316-407

Dashboard data pipeline

The exporter uses the same dashboard query meaning as the service. It resolves SQL-backed and semantic widget jobs, merges export filter values over dashboard defaults, and runs data work before it builds the presentation. This keeps the exported values tied to the dashboard’s active filters and semantic model context.

Charts use the query result to create PNG images before they are placed in Slides. Temporary chart images use Drive as a transfer step and are removed after the presentation is populated. A chart that cannot render is replaced by a placeholder rather than stopping the whole presentation.

References: pkg/…/export.go• L47-76 pkg/…/export.go• L122-146 pkg/…/export.go• L149-169 pkg/…/export.go• L270-314 pkg/…/api.go• L254-345 pkg/…/charts.go• L14-127

Raw dashboard representation

The raw dashboard API path serves the authored source file for a named dashboard without converting it into a new external format. YAML dashboards are returned as YAML and code-based dashboards are returned as TypeScript, so clients can inspect or retrieve the source representation that DAC loaded.

This path differs from Google Slides export. It does not execute queries or render widgets. It exposes the source document and therefore keeps the original authoring format visible to API consumers.

References: pkg/…/server.go• L140-151 pkg/…/api.go• L104-130 pkg/…/loader.go• L103-126

Change checklist

When these files or sections are changed, remember to consider these:

  • Change Metabase widget mappings together with the report counts and warning or placeholder behavior. These outputs are the main signal that an import was only partly converted.
  • Change semantic import names or generated file locations together with project path resolution and dashboard semantic references. A dashboard can load as YAML but fail when its generated model context is missing.
  • Change dashboard widget fields or query resolution together with the Slides renderer. The exporter reads resolved query columns by name, so a renamed field can affect metric, chart, and table output without changing the export command.
  • Change source file discovery or dashboard file types together with the raw dashboard API content type. Otherwise a client can receive the wrong representation for a dashboard that still loads locally.
  • Change filter semantics together with Metabase parameter mapping, dashboard query rendering, and export filter overrides. The same filter name must have compatible meaning at import, execution, and presentation time.

Important failure modes

TriggerConsequenceGuard
A live Metabase import lacks either the URL, dashboard ID, or both credentialsThe importer cannot fetch the source dashboardProvide both live-import identifiers and an API key or session token
A Metabase card uses unsupported query-builder behavior or lacks source metadataNormal mode writes a visible placeholder and warning; strict mode failsReview the import report or use strict mode when partial conversion is not acceptable
Semantic mode sees an unnamed aggregation or unsupported model-backed cardThe card stays SQL-backed; semantic strict mode fails insteadUse explicit Metabase metrics for durable semantic names or review the SQL fallback
Generated semantic files are not placed where the project loader expects themDashboard semantic references cannot resolve during normal project loadingKeep generated models in the project semantic directory or set the import semantic directory consistently
A dashboard query fails or returns no usable data during Slides exportThe affected widget renders as a missing-value or placeholder elementValidate the dashboard and its data sources before export
Google authorization or Slides/Drive service access is unavailableNo presentation is created or the export stops during setupUse valid Google credentials and enable the required APIs
A client expects raw API output to be a rendered dashboardIt receives YAML or TSX source rather than data or presentation contentUse the query endpoints for data and the Slides export for a rendered external artifact

Key files

FileWhy to read it
cmd/import.goDefines the Metabase import entry point, input modes, output paths, strictness choices, and semantic-file writes.
pkg/…/convert.goDescribes the source-to-dashboard conversion boundary and the main SQL, filter, widget, and layout mappings.
pkg/…/semantic.goDescribes how explicit Metabase models and metrics become DAC semantic project assets.
pkg/…/project.goShows how dashboard, semantic model, and theme paths form the project context used after import.
pkg/…/loader.goShows how imported YAML and generated semantic assets enter the normal dashboard load path.
cmd/export.goDefines the dashboard export command and its filter and credential inputs.
pkg/…/export.goShows the end-to-end path from a loaded dashboard and query results to a Google Slides URL.
pkg/…/charts.goShows the supported chart-to-image rendering boundary used by Slides export.
pkg/…/api.goDefines widget query resolution and execution, plus the raw dashboard source endpoint used by API clients.
pkg/…/server.goRegisters the raw dashboard route that exposes the original YAML or TSX source.