Skip to content

Extract with /p:ExtractTarget=File option doesn't extract (some) table constraints. #589

@LeonidShutov

Description

@LeonidShutov
  • SqlPackage or DacFx Version: 170.0.70-preview
  • .NET Framework (Windows-only) or .NET Core:
  • Environment (local platform and source/target platforms): Windows, source DB - Fabric Datawarehouse.

Steps to Reproduce:

  1. create a new Fabric Datawarehouse, and get connection string from it.
  2. create the following table and a constraint:
CREATE TABLE [dw6].[dbo].[Geography]
(
 [GeographyID] [int] NOT NULL,
...
)
GO
ALTER TABLE [dbo].[Geography] ADD CONSTRAINT [t] UNIQUE NONCLUSTERED ([GeographyID] ASC) NOT ENFORCED;

then call sqlpackage.exe extract and check results:

❯ sqlpackage.exe /at:%token% /action:Extract /p:ExtractTarget=File /TargetFile:"C:\src\tempfile170.sql" /SourceConnectionString:"Server=;Initial Catalog=dw1;Encrypt=True;"
Connecting to database 'dw1' on server ''.
Extracting schema
Extracting schema from database
Resolving references in schema model
Exporting database objects
Validating schema model for data package
Validating schema
Successfully extracted database and saved it to file 'C:\src\tempfile170.sql'.
Changes to connection setting default values were incorporated in a recent release. More information is available at https://aka.ms/dacfx-connection
Time elapsed 0:00:10.21

in resulting .sql file there is the table, but no constraint.
it works correctly without the /p:ExtractTarget=File flag:

❯ sqlpackage.exe /at:%token% /action:Extract /TargetFile:"C:\src\tempfile170.dacpac" /SourceConnectionString:"Server=;Initial Catalog=dw1;Encrypt=True;"
Connecting to database 'dw1' on server ''.
Extracting schema
Extracting schema from database
Resolving references in schema model
Exporting database objects
Validating schema model for data package
Validating schema
Successfully extracted database and saved it to file 'C:\src\tempfile170.dacpac'.
Changes to connection setting default values were incorporated in a recent release. More information is available at https://aka.ms/dacfx-connection
Time elapsed 0:00:12.71

if you open dacpac file, there is constraint exists in it.
constraint exists in the DB and can be seen in SSMS.

Did this occur in prior versions? If not - which version(s) did it work in?
yes, tested on version 162 too, observed the same behavior.

(DacFx/SqlPackage/SSMS/Azure Data Studio)
SqlPackage

Attached extract results sql and dacpac version
tempfile170.zip

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed-pending-releaseFix in upcoming releasesqldwIssues related to SQL DW and/or Synapse

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions