Skip to content

Conversation

@isaac-jaynes-imperva
Copy link

@isaac-jaynes-imperva isaac-jaynes-imperva commented Jan 7, 2026

Exporting a database connection will now include the 'configuration_method' in the exported yaml. This is used when importing a database connection (primarily Google BigQuery) to show the correct page when editing it, allowing the user to be shown the 'Service Account' input where they can add their credentials info.

Fixes #36956

After footage:

Screen.Recording.2026-01-07.at.3.03.46.PM.mov

Before footage:

Screen.Recording.2026-01-07.at.3.09.52.PM.mov

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 7, 2026

Code Review Agent Run #483bc7

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 36efb8e..b5fc96e
    • superset/databases/schemas.py
    • superset/models/core.py
    • tests/integration_tests/databases/commands_tests.py
    • tests/unit_tests/datasets/commands/export_test.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the data:connect Namespace | Anything related to db connections / integrations label Jan 7, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Backwards compatibility
    Existing database rows may have NULL/absent configuration_method (server_default applies only to new rows). Verify export, import and the UI handle NULL values gracefully and that the exported YAML doesn't produce unexpected errors when configuration_method is absent.

  • Import validation
    The PR adds configuration_method to export/import fields. Make sure imports handle missing or invalid values (older rows, malformed YAML). The string is stored as free-form text; importing unknown values could lead to inconsistent UI behaviour. Consider coercing to a safe default or validating against ConfigurationMethod.

  • Inconsistent representation
    The new configuration_method Enum is added to the Import V1 schema, but other schemas and serialized representations may treat configuration_method as a plain string (or have different defaults). Verify imports/exports and other schemas (and the frontend) expect the same representation and default when the field is missing to avoid subtle mismatches on import/export.

  • Missing round-trip coverage
    The change ensures configuration_method is exported, but there is no test verifying that an export containing configuration_method is correctly imported and persisted/handled (or gracefully ignored) by the importer. Add a round-trip test (export -> import) or a targeted import test to validate importer behavior for databases that require configuration_method (e.g., BigQuery service account flow).

  • Implicit default reliance
    The test expects configuration_method: sqlalchemy_form but the created Database instance isn't explicitly assigned a configuration_method. This relies on an implicit default in the model/exporter — the test should explicitly set or verify where the default comes from to avoid false positives if defaults change.

external_url = fields.String(allow_none=True)
ssh_tunnel = fields.Nested(DatabaseSSHTunnel, allow_none=True)
configuration_method = fields.Enum(
ConfigurationMethod, by_value=True, required=False, allow_none=True
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Logic bug: the new Enum field has no load_default, so when configuration_method is missing during import it will deserialize to None instead of the default enum value expected elsewhere; this can cause downstream logic that compares to enum members to behave incorrectly or miss the intended default behavior. Add a load_default to ensure a sensible default enum is set during deserialization. [logic error]

Severity Level: Minor ⚠️

Suggested change
ConfigurationMethod, by_value=True, required=False, allow_none=True
ConfigurationMethod,
by_value=True,
required=False,
allow_none=True,
load_default=ConfigurationMethod.SQLALCHEMY_FORM,
Why it matters? ⭐

Adding a load_default here is a harmless, sensible improvement: other parts of the file (DatabaseParametersSchemaMixin) already set a load_default for the same concept, so making the ImportV1 schema consistent avoids subtle downstream logic relying on an enum member vs None when the field is absent in older exports.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/databases/schemas.py
**Line:** 892:892
**Comment:**
	*Logic Error: Logic bug: the new Enum field has no load_default, so when `configuration_method` is missing during import it will deserialize to None instead of the default enum value expected elsewhere; this can cause downstream logic that compares to enum members to behave incorrectly or miss the intended default behavior. Add a load_default to ensure a sensible default enum is set during deserialization.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

"encrypted_extra",
"impersonate_user",
"ssh_tunnel",
"configuration_method",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Allowing configuration_method in extra_import_fields lets import payloads set arbitrary strings into the column, which can create invalid enum-like values in the DB; remove it from extra_import_fields so imports can't inject unvalidated values (or ensure import pipeline validates it explicitly). [security]

Severity Level: Critical 🚨

Suggested change
"configuration_method",
Why it matters? ⭐

Allowing unvalidated values to be imported into a field that is effectively an enum can lead to invalid DB state and surprising behavior. Removing it from extra_import_fields or otherwise enforcing validation in the import pipeline prevents uncontrolled values from being written. This suggestion addresses a real data-integrity/security concern visible in the diff.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/models/core.py
**Line:** 209:209
**Comment:**
	*Security: Allowing `configuration_method` in `extra_import_fields` lets import payloads set arbitrary strings into the column, which can create invalid enum-like values in the DB; remove it from `extra_import_fields` so imports can't inject unvalidated values (or ensure import pipeline validates it explicitly).

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit b5fc96e
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/695ed612f3b2ca000865ef1e
😎 Deploy Preview https://deploy-preview-36958--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Jan 7, 2026
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 7, 2026

Code Review Agent Run #f97ffc

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: b5fc96e..97ee9a7
    • superset/databases/schemas.py
    • superset/models/core.py
    • tests/integration_tests/databases/commands_tests.py
    • tests/unit_tests/datasets/commands/export_test.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@isaac-jaynes-imperva isaac-jaynes-imperva changed the title SO-160: Database connection export fix fix(database connection) Database connection export fix Jan 8, 2026
@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.19%. Comparing base (6f67b05) to head (97ee9a7).
⚠️ Report is 36 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #36958       +/-   ##
===========================================
+ Coverage        0   68.19%   +68.19%     
===========================================
  Files           0      639      +639     
  Lines           0    47702    +47702     
  Branches        0     5210     +5210     
===========================================
+ Hits            0    32528    +32528     
- Misses          0    13893    +13893     
- Partials        0     1281     +1281     
Flag Coverage Δ
hive 43.08% <100.00%> (?)
mysql 66.19% <100.00%> (?)
postgres 66.24% <100.00%> (?)
presto 46.67% <100.00%> (?)
python 68.15% <100.00%> (?)
sqlite 65.96% <100.00%> (?)
unit 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a 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 pull request fixes an issue with database connection exports by including the configuration_method field in the exported YAML. This field is essential for properly restoring the database connection configuration UI, particularly for Google BigQuery connections where users need to access the Service Account input field.

Changes:

  • Added configuration_method to the database export fields list in the Database model
  • Added configuration_method field definition to the ImportV1DatabaseSchema with appropriate defaults
  • Updated integration and unit tests to reflect the new field in exported database configurations

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
superset/models/core.py Added configuration_method to the export_fields list in the Database model
superset/databases/schemas.py Added configuration_method field to ImportV1DatabaseSchema with enum type, allowing None, and defaulting to SQLALCHEMY_FORM
tests/integration_tests/databases/commands_tests.py Updated the key order test to include configuration_method in the expected export field order
tests/unit_tests/datasets/commands/export_test.py Updated the expected database export output to include configuration_method: sqlalchemy_form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:connect Namespace | Anything related to db connections / integrations size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database connection export -> import fails to include any encrypted private keys

1 participant