Forum Discussion

justfetz's avatar
justfetz
Regular Visitor
10 days ago

updating .sqlproj file (version issue with git)

We recently had a couple issues syncing from main with INFORMATION SCHEMA errors.

When we reviewed the documentation Upgrade Fabric Data Warehouse System File Version in a Git Integrated Fabric workspace - Microsoft Fabric | Microsoft Learn, we noticed that we had two errors.  

The first is that we were self referencing in a couple PROCS, eg WH.dbo.Table from current WH.  

We fixed that problem, and th INFORMATION SCHEMA sync still persisted, but the self ref error went away.

Then we noticed that the sqlproj file is listed as a possible cause.  We have the old preview version listed in git.

However, if you export the warehouse project, the actual wh sqlproj file shows up to date.

So there is a difference b/w git and what is actually in the workspace.

We have tried to PR the change to this file, update it directly in git, make a small change in the wh and commit directly to main to see if we could trigger the change.  In the one case, we went into ADO, we updated this file directly, committed to it.  It actually SHOWED as an update for a hot second, BEFORE converting to a change and the change was showing the old definition.   

In that referenced article, we have tried a and b, and we cannot for whatever reason get this file to update in git, which then causes sync issues.  

Does anyone have experience with this, a recommendation?

Thanks J. 

5 Replies

  • v-kathullac's avatar
    v-kathullac
    Icon for Community Support rankCommunity Support

    Hi justfetz​ ,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

    Regards
    Chaithanya

  • Kagiyama_yutaka's avatar
    Kagiyama_yutaka
    Icon for Continued Contributor rankContinued Contributor

    The CI patch looks like it’s solving a different problem. Check .platform/config.version first. When System update available appears, commit the pending changes, apply the update, then commit the Warehouse from the workspace to Git.

    Export alone won’t update the repo .sqlproj. Since you’ve already tried both update paths, could you share the exact sync error and the Git versions from .platform and .sqlproj?

  • v-kathullac's avatar
    v-kathullac
    Icon for Community Support rankCommunity Support

    Hi justfetz​ ,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

    Regards
    Chaithanya

  • AvdBerg's avatar
    AvdBerg
    Frequent Visitor

    Hi justfetz​ 

    We ran into the same issue when we needed to update the SQL solution file in order to get some queries to work the way we want to, we are using YAML pipelines to build and deploy the solution, our pipeline failed on the build validation of the SQL solution of our queries, that was why we were looking to update. 
    We had the same issue that the update was oke for a second, but reverted and showed a change back to the old version in the workspace

    Our solution was to, set the build version during our build so we could validate the SQLproj file, i have included our solution from our build pipeline. Hopefully this helps you with your issue.

    Did I answer your question, please mark the post as a solution.

      - name: sqlProjSdkVersion   
        value: '2.2.0'
        # Build-only override. Fabric's git integration regenerates the
        # <Sdk Name="Microsoft.Build.Sql" Version="..."/> line in the .sqlproj
        # on every Commit from the workspace, so it must never be edited in git
        # (it will just show up as a revert diff in the Fabric portal). Pin the
        # version the CI build actually needs here instead, and patch it only into
        # this pipeline's disposable checkout, right before the dotnet build step.
    
    
        # Patch the SDK version only in this ephemeral checkout, never committed back.
        # Keeps the file Fabric owns untouched in git while giving the build the SDK
        # version it needs. Regex matches whatever version Fabric last wrote, since that
        # value can change over time as Microsoft updates the backend build packages.
        # Every *.Warehouse folder under folder/ is discovered and built, so adding
        # a new Warehouse to the solution needs no change to this pipeline.
        - script: |
            set -e
            shopt -s nullglob
            FOUND=0
            for SQLPROJ in folder/*.Warehouse/*.sqlproj; do
              FOUND=1
              echo "Pinning SDK version in ${SQLPROJ}"
              sed -i -E "s/(<Sdk Name=\"Microsoft.Build.Sql\" Version=\")[^\"]*(\")/\1$(sqlProjSdkVersion)\2/" "$SQLPROJ"
              # Report the resulting line, but never fail the step on a non-match:
              # under set -e a grep that finds nothing would abort the whole build.
              grep -m1 'Microsoft.Build.Sql' "$SQLPROJ" || echo "  (no Microsoft.Build.Sql SDK line in this project)"
            done
            if [ "$FOUND" -eq 0 ]; then
              echo "##vso[task.logissue type=error]No .sqlproj found under folder/*.Warehouse/"
              exit 1
            fi
          displayName: 'Pin Microsoft.Build.Sql SDK version (build-only, not committed)'



    • justfetz's avatar
      justfetz
      Regular Visitor

      Hi thank you very much for this.  I was out sick yesterday and I plan to look at this today.  This is more helpful than the Microsoft documentation.  Both methods presented on their website don't seem to fix the issue. I will update soon.