Skip to content

feat: [SQLDatabase] Support Restore and RestoreDeletedDatabase creationMode#258

Merged
aviatco merged 27 commits into
microsoft:mainfrom
aviatco:dev/aviatcohen/create-sqlDatabase-creation-payload-restore
Jul 2, 2026
Merged

feat: [SQLDatabase] Support Restore and RestoreDeletedDatabase creationMode#258
aviatco merged 27 commits into
microsoft:mainfrom
aviatco:dev/aviatcohen/create-sqlDatabase-creation-payload-restore

Conversation

@aviatco

@aviatco aviatco commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

📥 Pull Request

✨ Description of new changes

This pull request adds support for creating SQLDatabase resources with optional parameters and multiple creation modes, including "New", "Restore", and "RestoreDeletedDatabase". The changes refactor and expand the logic for SQLDatabase creation payloads, improve error handling and messages, and update the CLI's internal constants and validation. It also includes minor updates to test fixtures and removes an obsolete optimization change log.

SQLDatabase Creation Enhancements:

  • Added support for SQLDatabase creation with optional parameters, including new creation modes: "New", "Restore", and "RestoreDeletedDatabase". This is implemented via a new helper function _build_sql_database_creation_payload_if_exists in fab_cmd_mkdir_utils.py and new constants in fab_constant.py. [1] [2] [3] [4]
  • Updated the list of optional parameters for SQLDatabase creation to include backupRetentionDays, collation, referenceType, and restorableDeletedDatabaseName.

Error Handling Improvements:

  • Refactored and clarified error messages for SQLDatabase creation, including new messages for missing or invalid parameters, unsupported creation modes, and invalid backup retention days.

Code Cleanup and Maintenance:

  • Removed an unused import (is_valid_guid, is_valid_iso8601_timestamp) from fab_cmd_mkdir_utils.py.
  • Removed an obsolete optimization changelog entry regarding point-in-time restore validation.

Test Fixture Updates:

  • Updated test recordings in test_mkdir/class_setup.yaml to reflect new workspace IDs, API responses, and user agent strings, aligning with the new SQLDatabase creation logic. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

@aviatco aviatco requested a review from a team as a code owner July 1, 2026 10:01
Copilot AI review requested due to automatic review settings July 1, 2026 10:01
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread .changes/unreleased/✨ New Functionality-20260701-100039.yaml Outdated
ayeshurun
ayeshurun previously approved these changes Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends fab mkdir SQLDatabase support to handle additional creationMode values beyond New, specifically enabling restore-based database creation flows and updating tests/VCR recordings to cover the new payload shapes.

Changes:

  • Added SQLDatabase creationMode constants and payload-building logic for Restore and RestoreDeletedDatabase.
  • Expanded SQLDatabase optional parameters accepted by mkdir to include restore-related fields.
  • Added/updated unit + command tests and refreshed VCR cassettes for the new behaviors.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/fabric_cli/utils/fab_cmd_mkdir_utils.py Adds restore/restore-deleted creationPayload builders and required-param checks for SQLDatabase creation.
src/fabric_cli/errors/mkdir.py Adds/updates error messages for restore modes and unsupported creation modes.
src/fabric_cli/core/fab_constant.py Introduces new SQLDatabase creation mode constants.
tests/test_utils/test_fab_cmd_mkdir_utils.py Adds unit tests for new SQLDatabase creation payload modes.
tests/test_commands/test_mkdir.py Adds an end-to-end test covering Restore and RestoreDeletedDatabase flows.
tests/test_commands/recordings/test_commands/test_mkdir/test_mkdir_sqldatabase_with_creation_payload_success.yaml Updates an existing cassette for SQLDatabase creation payload behavior.
tests/test_commands/recordings/test_commands/test_mkdir/test_mkdir_sqldatabase_restore_and_restore_deleted_with_creation_payload_success.yaml Adds a new cassette for restore/restore-deleted scenarios.
tests/test_commands/recordings/test_commands/test_mkdir/class_setup.yaml Updates shared setup cassette used by mkdir tests.

Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Comment thread tests/test_commands/test_mkdir.py
Comment thread tests/test_commands/test_mkdir.py
Comment thread tests/test_commands/recordings/test_commands/test_mkdir/class_setup.yaml Outdated
Copilot AI review requested due to automatic review settings July 1, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 9 changed files in this pull request and generated 8 comments.

Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/errors/mkdir.py
Comment thread src/fabric_cli/errors/mkdir.py
Comment thread tests/test_commands/test_mkdir.py
Comment thread tests/test_commands/test_mkdir.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Co-authored-by: Alon Yeshurun <98805507+ayeshurun@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 17:26
Aviat Cohen added 2 commits July 1, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 9 changed files in this pull request and generated 6 comments.

Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Copilot AI review requested due to automatic review settings July 1, 2026 17:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 9 changed files in this pull request and generated 10 comments.

Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread src/fabric_cli/errors/mkdir.py Outdated
Comment thread tests/test_commands/test_mkdir.py Outdated
Comment thread tests/test_commands/test_mkdir.py Outdated
Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py Outdated
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Comment thread tests/test_commands/recordings/test_commands/test_mkdir/class_setup.yaml Outdated
Copilot AI review requested due to automatic review settings July 1, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread tests/test_commands/test_mkdir.py
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 9 changed files in this pull request and generated 1 comment.

Comment thread tests/test_commands/test_mkdir.py
Copilot AI review requested due to automatic review settings July 1, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread tests/test_commands/test_mkdir.py
Comment thread tests/test_commands/test_mkdir.py
Comment thread tests/test_utils/test_fab_cmd_mkdir_utils.py
@aviatco aviatco merged commit 6359031 into microsoft:main Jul 2, 2026
10 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.

[FEATURE] [SQL database] Create SQLDatabase by restoring from another database backup (point-in-time restore)

4 participants