Skip to content
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

feat(ibis): Enabled Passwordless Connection for Data Sources BE #1043

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ongdisheng
Copy link
Contributor

@ongdisheng ongdisheng commented Jan 24, 2025

Description

This PR introduces support for passwordless connections to data sources such as MySQL, PostgreSQL, MSSQL, and ClickHouse. By setting default password value to None, users can now access these data sources without specifying a password.

Note: Passwordless connections are not supported for Snowflake [ref: link]

If no password is specified, the user cannot log into Snowflake until a password has been explicitly specified for them.

Related Issue

Canner/WrenAI#1088

Summary by CodeRabbit

  • New Features

    • Made database connection passwords optional across multiple connection types
    • Improved error handling for password and SSL mode retrieval in database connections
  • Bug Fixes

    • Added null checks to prevent potential runtime errors when accessing sensitive connection information

Copy link

coderabbitai bot commented Jan 24, 2025

Walkthrough

The pull request introduces modifications to connection information classes in the Ibis server's model module. The primary change involves making the password field optional across multiple database connection classes, including ClickHouse, MSSql, MySQL, and Postgres. This modification allows the password to be None by default, providing more flexibility in connection configurations. Corresponding updates in the data source connection methods ensure robust handling of potentially absent passwords.

Changes

File Change Summary
ibis-server/app/model/__init__.py Updated password field in connection info classes from SecretStr to SecretStr | None = None for ClickHouse, MSSql, MySQL, and Postgres connection classes
ibis-server/app/model/data_source.py Modified connection methods to conditionally handle password retrieval, adding checks before calling get_secret_value()

Possibly related PRs

Suggested reviewers

  • goldmedal

Poem

🐰 Passwords dancing, now so free
Optional fields, a new decree
From SecretStr to None they leap
Connection magic, no longer steep
Flexibility blooms like spring's first tree! 🔑


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce21e44 and dd11fb8.

📒 Files selected for processing (2)
  • ibis-server/app/model/__init__.py (3 hunks)
  • ibis-server/app/model/data_source.py (5 hunks)
🔇 Additional comments (9)
ibis-server/app/model/__init__.py (4)

85-85: Allow optional password for ClickHouse.
Making password optional enhances passwordless connection workflows. Ensure that any references to this field across the codebase handle the None case appropriately.


93-93: Enable passwordless connections for MSSQL.
This change aligns with the PR intent, but verify that driver-based authentication methods are compatible with a None password.


106-106: Introduce optional password for MySQL.
Ensure that all third-party and custom SSL usage paths function as intended when no password is supplied. This is particularly relevant for certain MySQL server configurations.


123-123: Support optional password for Postgres.
This update correctly reflects passwordless usage, but confirm that the database’s host-based authentication is configured to accept such connections.

ibis-server/app/model/data_source.py (5)

121-121: Conditional retrieval of ClickHouse password.
The conditional info.password and info.password.get_secret_value() avoids errors if the password is None. This implementation correctly supports passwordless connections.


131-135: Safely escape MSSQL password or skip if None.
Skipping the escape logic when info.password is None accurately prevents runtime errors. This is a clean approach for passwordless connections.


153-153: Guard MySQL password retrieval with conditional check.
Properly checks if the password exists before calling get_secret_value(). This is consistent with the optional password pattern.


164-164: PostgreSQL password retrieval is safely optional.
Well-handled logic ensures no calls to get_secret_value() if info.password is None. This matches the new field signature.


195-197: Refined SSL mode handling for MySQL.
Conditional checks on info.ssl_mode avoid calling get_secret_value() when it is None. The approach is consistent and mitigates potential runtime errors.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added ibis python Pull requests that update Python code labels Jan 24, 2025
@ongdisheng ongdisheng marked this pull request as ready for review January 24, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ibis python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant