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.
Thank you but I am struggling with this specific issue and the documentation isnt really helping. its not specific enough (I have read them)
I have created a Fabric SQL Database
I then created a new folder in my dataengineering workspace for databases
I then opened this folder in visual Studio code.
And then created a SQL Database projeect. from Database Projects. Create Project from database
then I created my folder structure for tables views and stored procedures.
Then I clicked on Database projects. Right clicked on the project and Publish ' publish to an existing SQL Server
ue Profile (I used by publish xml file)
Chose the database and then clicked publish
Deploy DacPac failed. Could not load packages......
So yep. I want to know if this is specifically because its a Fabric database and it cant be done and I need to do something completely different and how to I backtrack not I have all the database project set up like I was used to doing with Azure Database?
from the documentation i can see I hadnt clicked build or checked out the sqlproj file to make sure everything was included which I have now done
- OnurOz9 months agoResolver III
could you share the exact error message that you're receiving when trying to publish your sql project to fabric? Maybe this could give us more hint. Please add this line into your publish profile:
<DeploymentDebug>true</DeploymentDebug>
One important hint: not every sqlproj is same. When you create a sql project using the fabric UI, it creates a different sqlproj file than what you normally create in visual studio...
For instance, below it is the default sql proj created by fabric UI (pay attention to DSP andPackageReference tags:<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build"> <Sdk Name="Microsoft.Build.Sql" Version="2.0.0-preview.5" /> <PropertyGroup> <Name>sqldb</Name> <ProjectGuid>{00000000-0000-0000-0000-000000000000}</ProjectGuid> <DSP>Microsoft.Data.Tools.Schema.Sql.SqlDbFabricDatabaseSchemaProvider</DSP> <ModelCollation>1033, CI</ModelCollation> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.SqlServer.Dacpacs.DbFabric"> <SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors> <DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue> <Version>170.0.0</Version> </PackageReference> </ItemGroup> <Target Name="BeforeBuild"> <Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" /> </Target> </Project>- apturlov9 months agoSuper User
As correctly mentioned by OnurOz, DSP in the .sqlproj file should be specific for a Fabric SQL database. Depending on a setting, deployment may fail if the DSP is different. The suggested way is to use a Database project generated by Fabric when a Fabric SQL database is committed to Git.
- DebbieE9 months agoCommunity Champion
" The suggested way is to use a Database project generated by Fabric when a Fabric SQL database is committed to Git. " But how do you do this. What are the steps?
- DebbieE9 months agoCommunity Champion
I created the SQL project using Visual Studio code and going to terminal. Should I not have done that?