Copy-DbaDbTableData - Name the Query requirement in the parameter guard message - #10678
Open
andreasjordan wants to merge 1 commit into
Open
Copy-DbaDbTableData - Name the Query requirement in the parameter guard message#10678andreasjordan wants to merge 1 commit into
andreasjordan wants to merge 1 commit into
Conversation
…rd message With Query and no Table or View the guard answered with the generic message, which reads as if SqlInstance or Database were missing. The requirement itself stays: the resolved SMO object supplies the source connection context, the structure AutoCreateTable scripts, the default destination table name and the source columns of the output object, so removing it is a feature change, not a bug fix. Copy-DbaDbViewData splats into this function and gets the same message for free. Fixes #10676 (do Copy-DbaDbTableData) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10676
Problem
Copy-DbaDbTableData -Querywithout-Tableor-Viewanswers with "You must pipe in a table or specify SqlInstance, Database and [View|Table]." - with-SqlInstance,-Databaseand-Queryall supplied, that reads as if the wrong parameters were missing, on what is often the most expensive scenario to get an unclear error on (chunked transfers of large tables).Why the requirement itself stays
The resolved SMO table or view is not just metadata garnish in
-Querymode: it supplies the source connection context ($sqlObject.Parent), the structureAutoCreateTablescripts, the default-DestinationTablename, the clustered-index and primary-key lookups, and the source columns of the output object. Making-Tableoptional with-Querymeans rebuilding all of that from the query alone - a feature-level change with real design questions (what doesAutoCreateTablescript? what do the Source* output columns show?), not a bug fix. The help for-Queryalready documents the requirement ("Still requires specifying a Table or View parameter for metadata purposes").What changed
The parameter guard now answers a
-Querycall with a message that names the actual gap:Everything else about the guard is unchanged, and calls without
-Querykeep the original message.Copy-DbaDbViewDataexposes-Querytoo and splats into this function, so it gets the same message for free.Tests
New regression test beside the existing
-Querytests: calling with-Queryand no-Tablereturns nothing and warns with the new message. Red ondevelopment(the generic message came back), green with the fix - through the testing-dbatools harness on both editions.Thanks @JankeUwe for the report.
created by Claude and reviewed by Andreas Jordan
🤖 Generated with Claude Code