Skip to content

Conversation

@dfalbel
Copy link
Contributor

@dfalbel dfalbel commented Nov 18, 2025

Addresses #10432

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

@github-actions
Copy link

github-actions bot commented Nov 18, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

@dfalbel dfalbel requested a review from Copilot November 21, 2025 12:42
Copilot finished reviewing on behalf of dfalbel November 21, 2025 12:46
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 PR adds AWS Redshift support to the Connections Pane, allowing users to connect to and browse Redshift databases within Positron.

Key Changes:

  • Implemented RedshiftConnection class with support for listing databases, schemas, tables/views, and fields
  • Added comprehensive test coverage for Redshift connections following the established testing patterns
  • Added redshift_connector dependency to test requirements

Reviewed Changes

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

File Description
extensions/positron-python/python_files/posit/positron/connections.py Adds RedshiftConnection class with methods for connection management, object listing, and data preview. Updates connection wrapping logic to recognize Redshift connections.
extensions/positron-python/python_files/posit/positron/tests/test_connections.py Adds TestRedshiftConnectionsService class with comprehensive tests for connection registration, data containment checks, icon retrieval, object listing, field listing, and preview functionality.
extensions/positron-python/python_files/posit/test-requirements.txt Adds redshift_connector as a test dependency.
extensions/positron-python/python_files/posit/pinned-test-requirements.txt Pins redshift_connector to version 2.1.10 for Python versions < 3.14.

self.conn = conn

try:
# Unfortunatelly there's no public API to get the host, so we access the protected member.
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

Spelling error: "Unfortunatelly" should be "Unfortunately".

Suggested change
# Unfortunatelly there's no public API to get the host, so we access the protected member.
# Unfortunately there's no public API to get the host, so we access the protected member.

Copilot uses AI. Check for mistakes.
assert comm_id in connections_service.comms

@pytest.mark.parametrize(
("path_kind"),
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

The @pytest.mark.parametrize decorator has incorrect syntax. For a single parameter, use "path_kind" instead of ("path_kind"). The parentheses without a trailing comma create a string, not a tuple. While this may still work, it's inconsistent with the pattern used elsewhere (e.g., line 382 in the Databricks test) and could lead to confusion.

Suggested change
("path_kind"),
"path_kind",

Copilot uses AI. Check for mistakes.
msg = _make_msg(params={"path": path}, method="contains_data", comm_id=comm_id)
dummy_comm.handle_msg(msg)
result = dummy_comm.messages[0]["data"]["result"]
assert result == (path_kind == "table")
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Inconsistent boolean assertion. This test uses assert result == (path_kind == "table") while the equivalent Databricks test at line 397 uses assert result is (path_kind == "table"). For consistency with the existing codebase, consider using is instead of == when comparing boolean values.

Suggested change
assert result == (path_kind == "table")
assert result is (path_kind == "table")

Copilot uses AI. Check for mistakes.
"# Authentication steps may be incomplete, adjust as needed.\n"
"import redshift_connector\n"
"con = redshift_connector.connect(\n"
f" iam = True,\n"
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

Unnecessary f-string prefix. This line doesn't contain any interpolated values, so it should be a regular string: " iam = True,\n" instead of f" iam = True,\n". This is consistent with the pattern used in other connection implementations (e.g., DatabricksConnection at lines 1198-1199, 1202-1203).

Suggested change
f" iam = True,\n"
" iam = True,\n"

Copilot uses AI. Check for mistakes.
# Rollback on error to avoid transaction issues
# for subsequent queries
self.conn.rollback()
raise e
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Use raise instead of raise e to re-raise the exception. This is more Pythonic and preserves the full traceback. The bare raise statement re-raises the current exception without modification.

Copilot uses AI. Check for mistakes.
# Rollback on error to avoid transaction issues
# for subsequent queries
self.conn.rollback()
raise e
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Use raise instead of raise e to re-raise the exception. This is more Pythonic and preserves the full traceback. The bare raise statement re-raises the current exception without modification.

Copilot uses AI. Check for mistakes.
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.

2 participants