Applies to: â SQL database in Microsoft Fabric
In this tutorial, you learn how to work with your SQL database in Fabric with Fabric git integration source control.
A SQL database in Microsoft Fabric has source control integration, or "git integration", allowing SQL users to track the definitions of their database objects over time. This integration enables a team to:
If you're unfamiliar with git, here are a few recommended resources:
This article presents a series of useful scenarios that can be used individually or in combination to manage your development process with SQL database in Fabric:
The scenarios in this article are covered in an episode of Data Exposed. Watch the video for an overview of the source control integration in Fabric:
PrerequisitesThis repository connection applies at the workspace level, such that a single branch in the repository is associated with that workspace. The repository can have multiple branches, but only the code in the branch selected in workspace settings will directly impact the workspace.
For steps to connect your workspace to a source control repository, see Get started with Git integration. Your workspace can be connected to an Azure DevOps or GitHub remote repository.
Add the Fabric SQL database to source controlIn this scenario, you'll commit database objects to source control. You might be developing an application where you're creating objects directly in a test database and track that database in source control just like your application code. As a result, you have access to the history of the definitions of your database objects and can use Git concepts like branching and merging to further customize your development process.
...
menu for the database, select Refresh Git sync status.As you continue to edit the database, including editing existing objects, you can commit those changes to source control by following the preceding steps.
Update the Fabric SQL database from source controlIn this scenario, you'll be creating database objects as code in the SQL projects extension in VS Code, then committing the files to source control before updating the Fabric SQL database from the source control integration. This scenario is targeted towards developers who prefer to work in VS Code, have existing applications using SQL projects, or have more advanced CI/CD pipeline requirements.
...
context menu for the source control project. Select Clone to copy your Azure DevOps repository to your local machine. If you're new to Azure DevOps, see the Code with git guide for Azure DevOps.<yourdatabase>.SQLDatabase
in VS Code after switching the branch..sql
file for at least one table you would like to create in the database within the folder structure for your database. The file should contain the CREATE TABLE
statement for the table. For example, create a file named MyTable.sql
in the folder dbo/Tables
with the following content:
CREATE TABLE dbo.MyTable
(
Id INT PRIMARY KEY,
ExampleColumn NVARCHAR(50)
);
Note
When making changes to the local SQL project, if there is a syntax error or use of unsupported features in Fabric, the database update will fail. You must manually revert the change in source control before you can continue.
Updating a SQL database in Fabric from source control combines a SQL project build and SqlPackage publish operation. The SQL project build validates the syntax of the SQL files and generates a .dacpac
file. The SqlPackage publish operation determined the changes necessary to update the database to match the .dacpac
file. Because of the streamlined nature of the Fabric interface, the following options are applied to the SqlPackage publish operation:
/p:ScriptDatabaseOptions = false
/p:DoNotAlterReplicatedObjects = false
/p:IncludeTransactionalScripts = true
/p:GenerateSmartDefaults = true
The source controlled SQL project can also be cloned to your local machine for editing in VS Code, Visual Studio, or other SQL project tools. The SQL project should be built locally to validate changes before committing them to source control.
Create a branch workspaceIn this scenario, you'll set up a new development environment in Fabric by having Fabric create a duplicate set of resources based on the source control definition. The duplicate database will include the database objects that we have checked into source control. This scenario is targeted towards developers that are continuing their application development lifecycle in Fabric and are utilizing the source control integration from Fabric.
In this scenario, you'll use the source control repository to review database changes before they're available for deployment. This scenario is targeted towards developers that are working in a team environment and are using source control to manage their database changes.
Create two workspaces with associated branches in the same repository, as described in the previous scenario.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4