feat: [SQLDatabase] Support Restore and RestoreDeletedDatabase creationMode#258
Open
aviatco wants to merge 27 commits into
Open
Conversation
ayeshurun
reviewed
Jul 1, 2026
ayeshurun
reviewed
Jul 1, 2026
ayeshurun
previously approved these changes
Jul 1, 2026
Contributor
There was a problem hiding this comment.
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
creationModeconstants and payload-building logic forRestoreandRestoreDeletedDatabase. - Expanded SQLDatabase optional parameters accepted by
mkdirto 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. |
Co-authored-by: Alon Yeshurun <98805507+ayeshurun@users.noreply.github.com>
added 2 commits
July 1, 2026 17:29
…ore' of https://github.com/aviatco/fabric-cli into dev/aviatcohen/create-sqlDatabase-creation-payload-restore
added 2 commits
July 1, 2026 18:04
Comment on lines
+285
to
+288
| # This test relies on live restore windows and non-deterministic | ||
| # restorableDeletedDatabaseName values, so it is skipped in live/record mode. | ||
| if is_record_mode() == False: | ||
| pytest.skip("Skipping restore/restore-deleted test in live (record) mode") |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
added 2 commits
July 1, 2026 19:57
…ore' of https://github.com/aviatco/fabric-cli into dev/aviatcohen/create-sqlDatabase-creation-payload-restore
Comment on lines
+285
to
+289
| # This test relies on live restore windows and non-deterministic | ||
| # restorableDeletedDatabaseName values, so it is skipped in live/record mode. | ||
| if is_record_mode() == False: | ||
| pytest.skip("Skipping restore/restore-deleted test in live (record) mode") | ||
|
|
Comment on lines
+303
to
+304
| if is_record_mode(): | ||
| time.sleep(300) |
Comment on lines
+344
to
+345
| if is_record_mode(): | ||
| time.sleep(60) |
Comment on lines
+447
to
451
| def test_build_sql_database_creation_payload_unsupported_mode_failure(self, creationmode): | ||
| """Test that an unsupported mode raises instead of defaulting to New.""" | ||
| with pytest.raises(FabricCLIError) as exc_info: | ||
| _build_sql_database_creation_payload_if_exists( | ||
| {"creationmode": mode}) | ||
| _build_sql_database_creation_payload_if_exists({"creationmode": creationmode}) | ||
|
|
ayeshurun
approved these changes
Jul 1, 2026
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.
📥 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:
_build_sql_database_creation_payload_if_existsinfab_cmd_mkdir_utils.pyand new constants infab_constant.py. [1] [2] [3] [4]backupRetentionDays,collation,referenceType, andrestorableDeletedDatabaseName.Error Handling Improvements:
Code Cleanup and Maintenance:
is_valid_guid,is_valid_iso8601_timestamp) fromfab_cmd_mkdir_utils.py.Test Fixture Updates:
test_mkdir/class_setup.yamlto 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]