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.
| Direction | Source | Result | Main purpose |
|---|---|---|---|
| Import | Metabase dashboard response or live dashboard | DAC dashboard YAML, with optional semantic model YAML files | Move a Metabase dashboard into a DAC project |
| Export | Loaded DAC dashboard and query results | Google Slides presentation | Share a dashboard as a static presentation |
| Source view | Loaded DAC dashboard file | Original YAML or TSX text over HTTP | Let 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 content | DAC result |
|---|---|
| Dashboard parameters | Dashboard filters |
| Native SQL question | SQL-backed widget |
| Supported model or table query | Generated SQL-backed widget |
| Scalar question | Metric widget |
| Chart question | Chart widget |
| Table, pivot, or map question | Table widget |
| Text content | Text widget |
| Unsupported card | Text 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
| Trigger | Consequence | Guard |
|---|---|---|
| A live Metabase import lacks either the URL, dashboard ID, or both credentials | The importer cannot fetch the source dashboard | Provide both live-import identifiers and an API key or session token |
| A Metabase card uses unsupported query-builder behavior or lacks source metadata | Normal mode writes a visible placeholder and warning; strict mode fails | Review the import report or use strict mode when partial conversion is not acceptable |
| Semantic mode sees an unnamed aggregation or unsupported model-backed card | The card stays SQL-backed; semantic strict mode fails instead | Use explicit Metabase metrics for durable semantic names or review the SQL fallback |
| Generated semantic files are not placed where the project loader expects them | Dashboard semantic references cannot resolve during normal project loading | Keep 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 export | The affected widget renders as a missing-value or placeholder element | Validate the dashboard and its data sources before export |
| Google authorization or Slides/Drive service access is unavailable | No presentation is created or the export stops during setup | Use valid Google credentials and enable the required APIs |
| A client expects raw API output to be a rendered dashboard | It receives YAML or TSX source rather than data or presentation content | Use the query endpoints for data and the Slides export for a rendered external artifact |
Key files
| File | Why to read it |
|---|---|
| cmd/import.go | Defines the Metabase import entry point, input modes, output paths, strictness choices, and semantic-file writes. |
| pkg/…/convert.go | Describes the source-to-dashboard conversion boundary and the main SQL, filter, widget, and layout mappings. |
| pkg/…/semantic.go | Describes how explicit Metabase models and metrics become DAC semantic project assets. |
| pkg/…/project.go | Shows how dashboard, semantic model, and theme paths form the project context used after import. |
| pkg/…/loader.go | Shows how imported YAML and generated semantic assets enter the normal dashboard load path. |
| cmd/export.go | Defines the dashboard export command and its filter and credential inputs. |
| pkg/…/export.go | Shows the end-to-end path from a loaded dashboard and query results to a Google Slides URL. |
| pkg/…/charts.go | Shows the supported chart-to-image rendering boundary used by Slides export. |
| pkg/…/api.go | Defines widget query resolution and execution, plus the raw dashboard source endpoint used by API clients. |
| pkg/…/server.go | Registers the raw dashboard route that exposes the original YAML or TSX source. |