Forum Discussion
Fabric SQL Database and Visual Studio Project
- 9 months ago
Hi DebbieE
If I've understood you correctly, to deploy SQL changes into a Fabric SQL Database that is under source control, you should use the Fabric deployment flow. Change your database code, commit to git (if necessary PR into fabric's branch), then use Source Control => Updates => “Update all” in Fabric UI. Then the item state is applied to the SQL Database.
I guess it publish a SQLproj directly to Fabric SQL Database is not always working ideally, although you could use SqlPackage.exe (with /p:AllowIncompatiblePlatform=true)
I recommend checking this page: SqlPackage for SQL database - Microsoft Fabric | Microsoft Learn and this one: Fabric SQL database source control integration - Microsoft Fabric | Microsoft Learn
Hope that helpsOnur
😊If this post helped you, feel free to give it some Kudos! 👍
✅And if it answered your question, please mark it as the accepted solution.
Hi DebbieE, thanks for sharing your journey with Fabric SQL database. You are absolutely correct that managing SQL database schema and implementing CI/CD with a Database project is considered a best practice and is very similar for Fabric SQL database, Azure SQL database, and even a SQL Server database. To answer your specific question, no, you haven't messed up, but you are in the beginning of setting up your database development environment and process, so you'd need more steps before it will be a smooth sailing.
There are two major approaches in database development and management and both can be used to complement each other: code-centric and visual. Code-centric means using a coding IDE for SQL like VS Code or Visual Studio, where the SQL database schema is represented by a set of SQL scripts. This approach is supported by a Database project, that you can use natively in VS Code and Visual Studio. The visual approach would be using graphical user interface like Fabric UI or SQL Management Studio to make schema shanges through UI operations.
In my personal opinion, SQL-based code-centric way is more efficient and straight forward and better aligned with development practices including CI/CD process. If you are not well familiar with that I suggest that you need to experiment a little and learn some basics. Because the database is represented as SQL code it starts from Git integration. Take a look at this article to understand how a Fabric database looks as a code Fabric SQL database source control integration - Microsoft Fabric | Microsoft Learn.
The next suggested steps:
1. Initialize your database with sample data to create a learning sample. You can easily delete it later once you are done with an exercise.
2. Integrate your Fabric workspace with Git and commit your Fabrci SQL database into Git.
3. Create a local development environment with VS Code (my suggestion as much easier and faster cross-platfrom environment) and Database project extension. Checkout your Fabric Git repo and open your Fabric SQL database as a database project in VS Code.
From this point you have flexible options to create your development process: you can develop code-first inside VS Code using SQL or visual and then commit changes into Git and update your SQL database in Fabric workspace from Git. Another approach is database-first, when you make changes to the database in Fabric UI and then commit the changes to Git. Either way gives you the same result as a SQL representation of your database schema in Git that you can use to deploy your database to practically any compatible SQL Server in the world.
For database deployment you, again, have multiple options: you can deploy using built-in Fabric deployment pipelines (Get started with SQL database deployment pipelines - Microsoft Fabric | Microsoft Learn) or you can use an external deployment pipeline in Azure DevOps or GitHub that can deploy from Git to a database SQL endpoint using sqlpackage command line utility (SqlPackage for SQL database - Microsoft Fabric | Microsoft Learn).
All that said, be prepared that some options are more complicated than the others and it will take some time to set the process up to your liking. If you need more support with this topic than this posts allow feel free to message me directly.
Hope this answer helps you get started.
If you find it useful, please consider giving kudos or marking as a solution.