littleK0i / SnowDDL

Declarative database change management tool for Snowflake
Apache License 2.0
105 stars 28 forks source link

Add --include-objects argument to deploy / destroy only specific objects #94

Closed AntoineLesparre closed 7 months ago

AntoineLesparre commented 8 months ago

Is your feature request related to a problem? Please describe. When multiple people are working/experimenting on tables or views in the same schema, apply/destroy actions tend to overwrite changes made by others. If a person is working on a single view, that person should be able to deploy/update only that view so the work on its feature branch would not impact other feature branches.

Describe the solution you'd like An argument --include-objects where we specify fully qualified names of objects we want to handle, separated by a comma for example (similar to -target= in terraform). --include-objects my_db.my_schema.table1,my_db.my_schema.view1 In singledb mode, it could be --include-objects my_schema.table1,my_schema.view1

Describe alternatives you've considered Using singledb and --include-object-types but it doesn't fit all use cases.

littleK0i commented 8 months ago

Developers should work on their own copies of objects to avoid conflicts. You may use --env-prefix in normal mode or create separate target databases in SingleDB mode. This is one of the core features which helps to scale development process to very big teams, if necessary.

Listing specific objects might help initially, but ultimately not going to scale when you have more developers or scripts working on the same objects.

Also, objects quite heavily depend on each other. Views depend on tables and other views. Foreign keys, masking policies, row access policies depend on tables. Functions depend on integrations, etc.

Eventually you may end up with a very long list of names when using this approach.