Database projects for Fabric warehouses

By Hatnest · Reviewed by Saurav Raj Joshi · Updated Nov 30, 2026

A warehouse is more than data: it is a set of tables, views, functions and procedures that evolve. A database project captures that schema as source code, one .sql file per object, so it can be reviewed, versioned and deployed the same way as application code. Warehouse database projects are in preview in the docs, so expect details to move.

Where projects appear

There are two routes, and they meet in the same format.

  1. Git integration. When a workspace with a warehouse is connected to Git, the warehouse is committed as a database project. In the repository its schema shows up as individual .sql files. Fabric uses an incremental, DacFx-based approach to apply differences, touching only what changed instead of rewriting the whole definition. This keeps diffs clean across branches. The default semantic model metadata file XMLA.json is deliberately left out of commits and updates.
  2. Local development in Visual Studio Code. With the SQL Database Projects and SQL Server (mssql) extensions, plus the .NET SDK, you build and publish a project from your own machine. SQL Server Management Studio is also supported for interactive work, but it is not the project tool.

The warehouse tooling is built on DacFx, which builds a project into a compiled dacpac, compares schemas, generates scripts and publishes.

Creating a project in VS Code

Choose one of these starts:

  • From scratch with the command Database Projects: New, choosing the target platform for a Fabric warehouse.
  • From the Database Projects pane with Create new.
  • From an existing warehouse: first connect with the mssql extension (using the warehouse's SQL connection string, which is not the same as the SQL analytics endpoint, and Microsoft Entra authentication), then use Create Project From Database. Folder structure by schema and object type is recommended, and permissions are excluded by default.

Only SDK-style projects are supported. The .sqlproj should reference the Microsoft.Build.Sql SDK, and you add a package reference to the Fabric warehouse system dacpacs. If you add that reference without the database variable literal value of master, the build passes but publish or script can fail when your code references sys objects. Keep the package versions current, because they change often.

The build and publish loop

  1. Edit the .sql file for an object. Nothing is changed in Fabric yet.
  2. Build to validate everything and produce the dacpac. Fix errors it reports.
  3. Publish to the target warehouse. Publish compares the project with the live warehouse, generates a script of the differences and runs it.

The first time you deploy, choose Generate Script and read the T-SQL, because generating makes no change to the target. Save your options in a publish profile (.publish.xml) and keep one per environment.

Settings that protect production

  • BlockOnPossibleDataLoss: stop the deployment if it would lose data, such as dropping a populated column. Keep it true in production.
  • DropObjectsNotInSource: removes target objects missing from the project. Handy for cleaning dev and test, dangerous in production.
  • Pre-deployment script: runs before the schema change, for example to archive data before dropping a table.
  • Post-deployment script: runs after it, for example to seed lookup data or re-enable constraints.

Write both scripts so they can run repeatedly without harm (idempotent) and avoid heavy work on large production tables. Security is a special case: permissions do not travel through source control automatically, so the docs suggest handling them in a post-deployment script.

Limitations to know

  • Commits are at warehouse level, not per object.
  • SQL analytics endpoints are not version controlled, and dependencies between a warehouse and an endpoint are not supported.
  • Warehouses that reference each other in a cycle make branch-out and sync fail.
  • Assuming that pre- and post-deployment scripts (preview) behave the same when they are added through Git as when they are set in the portal. Check the current docs first.
  • Promoting between warehouses with different collations is unsupported.

Common mistakes

  • Editing the project and forgetting that nothing reaches Fabric until publish.
  • Turning on object dropping against production.
  • Using a project that is not SDK-style.

For the exam

  • Git integration stores a warehouse as a database project of .sql files.
  • VS Code needs the SQL Database Projects extension and the .NET SDK; only SDK-style projects work.
  • Build produces a dacpac; publish applies the differences; generate a script first.
  • Keep BlockOnPossibleDataLoss on and DropObjectsNotInSource off in production.
  • Permissions need a script-based approach.

Sources