Model Import & Export
Move SQL models between Weld workspaces, back them up, or export them to dbt - all through simple zip file uploads and downloads.
Overview
Weld's model import and export features let you bulk-transfer your SQL models as .sql files packaged in a zip archive. Whether you want to migrate models between workspaces, create backups, or transition to a dbt project, these features have you covered.
Export downloads your published models as a zip archive - either in Weld-native format or as a ready-to-use dbt project.
Import lets you upload a zip of .sql files into your workspace. Weld automatically detects whether the files are Weld-native or dbt-formatted, resolves dependencies, and creates or updates models accordingly.
Export
You can export all models in your workspace, or select specific models to export. Two export formats are available:
Weld-Native Export
Downloads a zip containing:
- One
.sqlfile per model, organized in your existing folder structure - A
manifest.jsonwith metadata (model IDs, names, materializations, dependencies, documentation)
The SQL in each file uses Weld's native syntax. This format is ideal for backups or migrating models between Weld workspaces.
dbt Export
Downloads a zip containing a ready-to-use dbt project:
dbt_project.yml- project configurationmodels/sources.yml- source definitions derived from your raw data dependencies- One
.sqlfile per model undermodels/, with Jinja{{ ref() }}and{{ source() }}syntax - Materialization configs (e.g.
{{ config(materialized='table') }}) where applicable
If your workspace has models with duplicate names in different folders, the
dbt export automatically disambiguates them by prefixing folder names and adds
an alias config so the table name in your data warehouse stays the same.
Import
Upload a .zip file containing .sql files to create or update models in your workspace. The import supports both Weld-native and dbt-formatted SQL files.
How It Works
- Upload your zip - Weld extracts and analyzes all
.sqlfiles in the archive. - Automatic format detection - Weld detects whether your files are dbt (by looking for
dbt_project.yml,sources.yml, or Jinja patterns like{{ ref() }}) or Weld-native. - Dry run - Before any changes are applied, you get a preview showing exactly what will happen:
- Create - New models that don't exist yet in your workspace.
- Update - Existing models whose SQL has changed.
- No change - Models that already match what's in the zip.
- Error - Files that can't be imported (unresolved dependencies, unsupported Jinja, etc.).
- Review and commit - Once you're satisfied with the dry run results, confirm to apply the changes.
Folder Structure
The folder structure inside your zip is preserved. If you upload a file at analytics/marketing/campaign_stats.sql, Weld creates the analytics > marketing folder hierarchy and places the campaign_stats model inside it.
Dependency Resolution
During import, Weld resolves all model and source references:
- Weld-native files: Dependencies using Weld's internal tag format are matched to existing models and raw views in your workspace.
- dbt files:
{{ ref('model_name') }}and{{ source('schema', 'table') }}references are resolved to the corresponding Weld models and synced raw data tables.
If a dependency can't be resolved, the file is flagged as an error and won't be imported.
Materialization
- For dbt files, the
{{ config(materialized='...') }}block is read and mapped to Weld materialization types (table,view). - If no materialization is specified, models default to view.
- Unsupported materializations (e.g.
incremental,ephemeral) are treated as view.
Limitations
Please read through the following limitations before using model import/export.
Import Limitations
| Limitation | Details |
|---|---|
| Max upload size | 50 MB (compressed zip). |
| Max uncompressed size | 200 MB total across all files. |
| Max number of SQL files | 500 per zip. |
| Max single file size | 5 MB per .sql file. |
| Unsupported Jinja | Only ref(), source(), and config() are supported for dbt files. Advanced Jinja (macros, if/for blocks, var(), custom tests, etc.) must be removed before importing. |
| Unresolved dependencies | All referenced models and sources must already exist in your Weld workspace. If a dependency can't be matched, the file will fail to import. |
| Incremental / ephemeral models | dbt incremental and ephemeral materializations are not natively supported. These are imported as view materializations. |
| Session expiry | Dry run sessions expire after 15 minutes. If you don't commit within that window, you'll need to re-upload the zip. |
| Data warehouse required | Your workspace must have an active data warehouse connection. Models cannot be created without one. |
| No model deletion | Import only creates or updates models. It does not delete models that exist in your workspace but are missing from the zip. |
Export Limitations
| Limitation | Details |
|---|---|
| Published models only | Only models with a published query are included in the export. Draft or unpublished models are excluded. |
| dbt compatibility | The dbt export provides a starting point, but may require adjustments for advanced dbt features (custom macros, tests, snapshots, etc.). |
| Unresolved internal references | Any {{ }} expressions in model SQL that are not ref(), source(), or config() are silently stripped during dbt export. |
Rate Limits
Both import and export endpoints are rate-limited to 10 requests per hour per user to prevent abuse.