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.
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 and
<?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>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?
- OnurOz9 months agoResolver III
You have to open the fabric portal, navigate to your workspace and create a new SQL Database item. Once created, you can now edit the sqlproj. I strongly suggest having a look into this Microsoft Reactor video: SQL database in Fabric Ep. 5: Application Lifecycle Management with SQL database in Fabric