Skip to content

feat: add Insights Snowflake connectivity validation - #200

Merged
santhosh-apphelix-2u merged 8 commits into
masterfrom
lp-928-insights-snowflake-connectivity
Jul 28, 2026
Merged

feat: add Insights Snowflake connectivity validation#200
santhosh-apphelix-2u merged 8 commits into
masterfrom
lp-928-insights-snowflake-connectivity

Conversation

@santhosh-apphelix-2u

Copy link
Copy Markdown

Description

Adds a connection-only Snowflake validation path for Insights analytics in edx-analytics-data-api.

This PR does not change existing dashboard API behavior, API response contracts, Aurora query logic, or frontend routing. Existing Analytics API endpoints remain Aurora-backed.

Changes

  • Adds default INSIGHTS_SNOWFLAKE settings.
  • Adds snowflake-connector-python and explicit cryptography dependencies.
  • Adds a small Snowflake client helper for:
    • reading settings.INSIGHTS_SNOWFLAKE
    • validating required config keys
    • loading/converting the private key
    • creating a Snowflake connection
    • running a read-only validation query
  • Adds check_insights_snowflake Django management command for deployed runtime validation.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  analytics_data_api
  snowflake_client.py
  analytics_data_api/management/commands
  check_insights_snowflake.py
  analytics_data_api/management/commands/tests
  test_check_insights_snowflake.py
  analytics_data_api/tests
  test_snowflake_client.py
Project Total  

This report was generated by python-coverage-comment-action

@santhosh-apphelix-2u
santhosh-apphelix-2u force-pushed the lp-928-insights-snowflake-connectivity branch from ad99eb2 to 2c1e3d0 Compare July 28, 2026 03:21
@santhosh-apphelix-2u
santhosh-apphelix-2u marked this pull request as ready for review July 28, 2026 09:47
Copilot AI review requested due to automatic review settings July 28, 2026 09:47
@santhosh-apphelix-2u
santhosh-apphelix-2u merged commit 69af584 into master Jul 28, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a Snowflake “connectivity-only” validation path for Insights analytics, intended for operational smoke-testing via a Django management command without altering existing Aurora-backed API endpoints.

Changes:

  • Introduces default INSIGHTS_SNOWFLAKE settings in the Django base settings module.
  • Adds a small Snowflake helper module plus a check_insights_snowflake management command to validate connectivity using a read-only query.
  • Updates dependency lockfiles to include snowflake-connector-python and related transitive dependencies, and adds unit tests covering the helper and command.

Reviewed changes

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

Show a summary per file
File Description
requirements/base.in Adds cryptography and snowflake-connector-python to base inputs for compilation.
requirements/base.txt Updates compiled base dependency set to include Snowflake connector + transitive deps.
requirements/dev.txt Updates compiled dev dependency set to include Snowflake connector + transitive deps.
requirements/doc.txt Updates compiled docs dependency set to include Snowflake connector + transitive deps.
requirements/production.txt Updates compiled production dependency set to include Snowflake connector + transitive deps.
requirements/test.txt Updates compiled test dependency set to include Snowflake connector + transitive deps.
analyticsdataserver/settings/base.py Adds default INSIGHTS_SNOWFLAKE configuration scaffold.
analytics_data_api/snowflake_client.py Adds helper functions for config validation, private key conversion, connect, and validation queries.
analytics_data_api/tests/test_snowflake_client.py Adds unit tests for the Snowflake helper module.
analytics_data_api/management/commands/check_insights_snowflake.py Adds a management command to run the runtime connectivity check.
analytics_data_api/management/commands/tests/test_check_insights_snowflake.py Adds tests for the management command output and error handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +101 to +104
"""Run a read-only Snowflake query and return all rows."""
if not sql.lstrip().upper().startswith('SELECT '):
raise SnowflakeConfigurationError('Only SELECT queries are allowed for Insights Snowflake validation.')

Comment on lines +111 to +115
finally:
if cursor is not None:
cursor.close()
connection.close()

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.

4 participants