microsoft / microsoft/DacFx

avoid truncate for data extraction from DACPAC graph tables data - truncate vs edge constraint

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug sql-feature
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

*Originally posted https://feedback.azure.com/forums/908035-sql-server/suggestions/43813659-avoid-truncate-for-data-extraction-from-dacpac-gra*

it is possible to extract DACPAC containing table data. This works also for graph tables containing edge constraints. But it is not possible to restore the data from the DACPAC because the restore process uses truncate, and this is not valid on tables with edge constraints.

How to reproduce:

create graph tables (nodes and edges)
define edge constraints
fill the tables with data
extract to a dacpac using the /Action:Extract and /p:ExtractAllTableData=TRUE
try to restore dacpac with data using /Action:Publish
see the errors
Updating database (Failed)
*** Could not deploy package.
Warning SQL72038: The object [readonly] already exists in database with a different definition and will not be altered.
Error SQL72014: .Net SqlClient Data Provider: Msg 13944, Level 16, State 1, Line 1 Cannot truncate table 'graph.RepoObject' because it is being referenced by an EDGE constraint.
Error SQL72045: Script execution error. The executed script:
TRUNCATE TABLE [graph].[RepoObject];

see a detailed description and workaround here:
https://datahandwerk.github.io/dhw/0.1.0/manual/backup-repo-db.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by creating graph node and edge tables with edge constraints, extracting with /Action:Extract and /p:ExtractAllTableData=TRUE, then publishing with /Action:Publish. Inspect the deployment output where TRUNCATE TABLE causes Msg 13944. Done means the extracted data can be published without the edge-constraint truncate failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.