Skip to content

feat: support SQL database creation with initial properties#250

Open
v-alexmoraru wants to merge 4 commits into
microsoft:mainfrom
v-alexmoraru:v-alexmoraru/new-SQLDatabase-with-initial-properties
Open

feat: support SQL database creation with initial properties#250
v-alexmoraru wants to merge 4 commits into
microsoft:mainfrom
v-alexmoraru:v-alexmoraru/new-SQLDatabase-with-initial-properties

Conversation

@v-alexmoraru

@v-alexmoraru v-alexmoraru commented Jun 18, 2026

Copy link
Copy Markdown
Member

Fixes #148.

Builds proper payload for creation of SQL databases with initial properties such as backup retention days, mode or collation.

@v-alexmoraru v-alexmoraru requested a review from a team as a code owner June 18, 2026 04:35
Copilot AI review requested due to automatic review settings June 18, 2026 04:35

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

Adds support for creating SQL_DATABASE items with an optional creationPayload so initial SQL Database properties (and creation mode) can be set at creation time.

Changes:

  • Add _build_sql_database_creation_payload (and backup retention validation) and wire it into add_type_specific_payload for ItemType.SQL_DATABASE.
  • Introduce new SQL Database constants (creation modes, backup retention bounds) and CommonErrors helpers for validation messaging.
  • Add unit tests covering payload generation and validation scenarios; add a changelog entry.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_utils/test_fab_cmd_mkdir_utils.py Adds tests for SQLDatabase creation payload building/validation.
src/fabric_cli/utils/fab_cmd_mkdir_utils.py Builds/validates SQLDatabase creationPayload and attaches it during mkdir.
src/fabric_cli/errors/common.py Adds error message helpers for SQLDatabase creation mode/property validation.
src/fabric_cli/core/fab_constant.py Adds SQLDatabase constants for creation modes and backup retention limits.
.changes/unreleased/added-20260618-043404.yaml Records changelog entry for the new SQL db creation support.

Comment thread src/fabric_cli/utils/fab_cmd_mkdir_utils.py
Comment thread src/fabric_cli/core/fab_constant.py
backup_retention_days = params.get("backupretentiondays")
collation = params.get("collation")

if mode is None and backup_retention_days is None and collation is None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what if one of them isnt none? what should be the outcome?

Comment on lines +223 to +225
creation_payload = _build_sql_database_creation_payload(params)
if creation_payload:
payload_dict["creationPayload"] = creation_payload

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
creation_payload = _build_sql_database_creation_payload(params)
if creation_payload:
payload_dict["creationPayload"] = creation_payload
creation_payload = _build_sql_database_creation_payload_if_exists(params)
if creation_payload:
payload_dict["creationPayload"] = creation_payload

Comment on lines +834 to +835
else:
mode = fab_constant.SQL_DATABASE_CREATION_MODE_NEW

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why we need to set something at all if not provided?

raise ValueError()
except (ValueError, TypeError):
raise FabricCLIError(
CommonErrors.invalid_backup_retention_days(str(value), min_days, max_days),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in the other pr you already doing it, consider having one pr that implements both.

if mode is None and backup_retention_days is None and collation is None:
return None

# Resolve and validate mode

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i dont think we should validate the creationPayload input, it is the workload responsibility. we do need to make sure we support creating the artifact with those optional params.

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 new SQLDatabase with initial properties (backupRetentionDays, collation)

3 participants