Skip to content

Feature/small updates#122

Merged
SQLDBAWithABeard merged 9 commits intodevelopfrom
feature/small-updates
Jun 16, 2025
Merged

Feature/small updates#122
SQLDBAWithABeard merged 9 commits intodevelopfrom
feature/small-updates

Conversation

@SQLDBAWithABeard
Copy link
Contributor

@SQLDBAWithABeard SQLDBAWithABeard commented Jun 14, 2025

Pull Request

Pull Request (PR) description

updating the help to remove backticks
Improving the exit of the incompatible parameters so that there is no red error.
Adding end block as required by begin and process to return details from multiple objects in preparation for improving the output and making it more user friendly

image

image

Task list

  • [ X] The PR represents a single logical change. i.e. Cosmetic updates should go in different PRs.
  • [ X] Added an entry under the Unreleased section of in the CHANGELOG.md as per format.
  • [X ] Local clean build passes without issue or fail tests (build.ps1 -ResolveDependency -Tasks build, test).
  • [ X] Comment-based help added/updated.
  • [ X] Examples appropriately added/updated.
  • [X ] Unit tests added/updated..
  • Integration tests added/updated (where possible).
  • Documentation added/updated (where applicable).
  • Code follows the contribution guidelines.

Corrected the function name from Get-SqlDatabase to Get-FabricSqlDatabase in the CHANGELOG.
Updated examples in the Get-FabricSQLDatabase function to improve clarity and consistency.
Thank you!
Refactor the function to return warnings instead of throwing errors when both SQLDatabaseName and SQLDatabaseId are provided. Update the synopsis and description for clarity. Ensure the return value is correctly handled in the End block.

Thank you!
@github-actions
Copy link

github-actions bot commented Jun 14, 2025

Linux Test Results

4 568 tests   4 567 ✅  41s ⏱️
  405 suites      1 💤
    1 files        0 ❌

Results for commit 286d251.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jun 14, 2025

WinPS51 Test Results

4 773 tests   4 772 ✅  50s ⏱️
  406 suites      1 💤
    1 files        0 ❌

Results for commit 286d251.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jun 14, 2025

WinPS71 Test Results

4 773 tests   4 772 ✅  50s ⏱️
  406 suites      1 💤
    1 files        0 ❌

Results for commit 286d251.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@jpomfret jpomfret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@NowinskiK NowinskiK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few small comments. Thanks!

Clarify the function's synopsis and description to enhance understanding.
Corrected the spelling of "examples" and updated the URI to follow the correct casing for SQL databases.

Thank you!
Changed the example command to use quotes around the workspace name for consistency and clarity. This helps users understand the correct syntax when using the function.

Thank you!
Changed the workspace name in the example to 'MsLearn-dev' because thats important

Thank you!
This change restructures the function to ensure that the SQLDatabaseName and SQLDatabaseID parameters cannot be used together, enhancing the clarity of parameter usage. The process block has been properly defined to maintain code organization and readability.

Thank you!
Reorganize function structure and enhance code clarity by adjusting the formatting of the function definition and control structures. This change aims to make the code more maintainable and easier to understand.

Thank you!
@SQLDBAWithABeard
Copy link
Contributor Author

I have reverted back to the validation as you had it so please have a look and see if you can find anything else

@NowinskiK
Copy link
Contributor

When testing the function I found one error:
image

Get-FabricWorkspace | where { $_.displayName -like 'mslearn-*' } | Get-FabricSQLDatabase -SQLDatabaseName 'AdventureWorksLT_dev'

@SQLDBAWithABeard
Copy link
Contributor Author

SQLDBAWithABeard commented Jun 15, 2025

HO

When testing the function I found one error: image

Get-FabricWorkspace | where { $_.displayName -like 'mslearn-*' } | Get-FabricSQLDatabase -SQLDatabaseName 'AdventureWorksLT_dev'

image

I cant reproduce this with this branch as you can see in my images

even though I have multiple workspaces

PS > get-fabricWorkspace | Where displayName -like 'blog*'

id          : 9e52da3e-8c56-42dd-ad44-d4452114c0b3
displayName : BlogPostWorkspace
description : A workspace for a blog post
type        : Workspace
capacityId  : 53e1c034-d719-443e-be93-188f10f8dcca

id          : b5db4f9a-3513-4dd0-8eb7-bbe662058c65
displayName : blog1
description :
type        : Workspace

Each Workspace has a Fabric SQL Database even putting the name of the database does not lead to an error here

image

what is returned from

Get-FabricWorkspace | where { $_.displayName -like 'mslearn-*' }

Please can you provide some more details.

Confirm that you are on the correct branch
Have built in a new clean session
Which version of PoweShell you are using

If you still get the error please can you post all of the code that you entered since the session started with

Get-History | scb

and also the results of

Get-Error -Newest 5 | scb

This change introduces an initialization of the return array at the beginning of the Get-FabricSQLDatabase function. This will ensure that the function has a defined return structure, improving its reliability and maintainability.

Thank you!
@NowinskiK
Copy link
Contributor

Yes, branch is ok - feature/small-updates. I have code in VSCode because it was easier to review the whole function after the changes.
I always build the module.

Get-FabricWorkspace -WorkspaceName 'mslearn-dev'
image

It works without providing SQLDatabaseName:
Get-FabricWorkspace -WorkspaceName 'mslearn-dev' | Get-FabricSQLDatabase
image

I think it happens when one of the workspaces does not have any databases. Please check that.

@SQLDBAWithABeard
Copy link
Contributor Author

Yes, branch is ok - feature/small-updates. I have code in VSCode because it was easier to review the whole function after the changes. I always build the module.

Get-FabricWorkspace -WorkspaceName 'mslearn-dev' image

It works without providing SQLDatabaseName: Get-FabricWorkspace -WorkspaceName 'mslearn-dev' | Get-FabricSQLDatabase image

I think it happens when one of the workspaces does not have any databases. Please check that.

Thats interesting.

Did you have the results of the get-error?
and the code you ran

Copy link
Contributor

@NowinskiK NowinskiK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works now! Good job! Thanks!

This change ensures that the return array is only updated if there is a valid response from the SQLDatabase filtering. This prevents potential errors when no matching databases are found.

Thank you!
@SQLDBAWithABeard
Copy link
Contributor Author

Resolved with some validation
image

@SQLDBAWithABeard SQLDBAWithABeard merged commit c7f0638 into develop Jun 16, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants