-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[SQL] Introduced changes to cli commands to support self-server restore of sql logical server #32245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
🔄AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| sql server create | cmd sql server create added parameter enable_soft_delete |
||
| sql server create | cmd sql server create added parameter soft_delete_retention_days |
||
| sql server deleted-server | sub group sql server deleted-server added |
||
| sql server restore | cmd sql server restore added |
||
| sql server update | cmd sql server update added parameter enable_soft_delete |
||
| sql server update | cmd sql server update added parameter soft_delete_retention_days |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
bb903a5 to
da66134
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces changes to support SQL Server soft delete functionality, adding new commands and parameters for server creation, update, and restoration operations. The changes enable users to create SQL servers with soft delete protection, modify soft delete settings on existing servers, and restore previously deleted servers.
- Adds new
az sql server restorecommand for recovering deleted SQL servers - Extends
az sql server createandaz sql server updatecommands with soft delete parameters - Implements comprehensive validation for soft delete retention days (1-7 days when enabled, 0 when disabled)
Reviewed Changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test_sql_commands.py | Added comprehensive test suite for soft delete functionality with multiple scenarios |
| test recordings (2 files) | Added test recording files for new soft delete test cases |
| custom.py | Implemented server restore functionality and soft delete parameter handling |
| commands.py | Added new restore command to SQL server command group |
| _validators.py | Added validation logic for soft delete parameters with proper error handling |
| _util.py | Added utility function to access deleted servers API operations |
| _params.py | Added command line parameters for soft delete options |
| _help.py | Added help documentation and examples for new soft delete features |
Comments suppressed due to low confidence (2)
src/azure-cli/azure/cli/command_modules/sql/_help.py:1
- The help message should start with a verb in active voice. Consider changing 'Set whether soft delete is enabled or not' to 'Enable or disable soft delete protection' to follow the help message format guidelines.
# coding=utf-8
src/azure-cli/azure/cli/command_modules/sql/_help.py:1
- The help message should start with a verb in active voice. Consider changing 'The number of days to retain soft deleted resources' to 'Specify the number of days to retain soft deleted resources' to follow the help message format guidelines.
# coding=utf-8
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 13 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/sql/custom.py:4436
- The docstring uses triple single quotes instead of triple double quotes. Python convention is to use triple double quotes for docstrings.
'''
Creates a server.
'''
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Can you please add negative test cases for each validation scenario related to options enable soft delete and retention days? |
pranavathalye
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done with review.
Added. |
@rambabu-yalla Do you want to merge this PR now? |
|
|
@rambabu-yalla Please remove the draft state when you are ready for review and merge |
f3c33a7 to
d858717
Compare
2bc4c9c to
069878c
Compare
Added negative tests |
069878c to
adc583e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 16 out of 25 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@DanielMicrosoft : Can you please run the pipeline on this PR and change the milestone to upcoming milestone. |
Related command
The change includes
Modify command: az sql server create
Modify command: az sql server update
- Added new parameter --soft-delete-retention-days
- az sql server update --name MyAzureSQLServer --resource-group MyResourceGroup --soft-delete-retention-days 5
Add new command: az sql server deleted-server show
- az sql server deleted-server show --name servername --location eastasia
Add new command: az sql server deleted-server list
- az sql server deleted-server list --location eastasia
Add new command: az sql server restore,
Description
This is to support soft delete public preview feature
Testing Guide
Create a server with soft delete enabled with retention days, 7
az sql server create -l westus -g mygroup -n myserver -u myadminuser -p myadminpassword --soft-delete-retention-days 7
Modify soft delete retention period.
az sql server update --name myserver --resource-group mygroup --soft-delete-retention-days 5
Delete a soft delete enabled server
show a deleted server
az sql server deleted-server show --name myserver --location westus
Restore a deleted server.
az sql server restore -n myserver -g mygroup -l westus
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.