microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
313 stars 19 forks source link

Making change to one external table results in all external tables getting dropped and recreated when Published to existing database #452

Closed NathanMSFT closed 1 week ago

NathanMSFT commented 4 months ago

I have a database project with many PolyBase external tables. When I make a change to one of the external tables and build the project, EVERY external table in the project gets dropped and recreated. I would expect only the external table that was changed would be dropped/recreated. The problem behavior was noticed when I made a change to one of the external tables that broke the table (incompatible datatype for a column).

The build of the project is successful, but when I publish with SqlPackage /Action:Publish I see that all external tables are dropped and recreated in alphabetical order. When the problem table’s CREATE EXTERNAL TABLE statement fails to execute (due to incompatible datatype for the column), then the Publish Action stops and SqlPackage makes no attempt to create the remaining external tables. This behavior wouldn’t happen if only the table that was changed was dropped and recreated.

My expectation is that only the table that was changed would be dropped/recreated Steps to Reproduce:

  1. Create a database with multiple external tables
  2. Create a new SSDT database project
  3. Import the database into the SSDT project
  4. Make a change to one of the external tables
  5. Build the DACPAC
  6. Execute SqlPackage /Action:Publish and publish to existing database

Did this occur in prior versions? If not - which version(s) did it work in? Not sure. Didn't test in other versions.

(DacFx/SqlPackage/SSMS/Azure Data Studio)