Skip to content

Conversation

@vinay79n
Copy link
Contributor

@vinay79n vinay79n commented Dec 2, 2025

Replace cursor.execute() with run_sql utility for executing SQL queries using conn.execute_string instead.

Copy link

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 refactors SQL execution across the codebase by replacing direct cursor.execute() calls with a new run_sql utility function that uses Snowflake's conn.execute_string() method instead. This change affects multiple modules including pandas operations, write/audit/publish workflows, and connection initialization.

Key Changes:

  • Introduced new run_sql utility function in src/ds_platform_utils/shared/utils.py that wraps execute_string and returns the last cursor
  • Replaced all cursor.execute() calls with run_sql() across metaflow and snowflake modules
  • Version bumped from 0.2.3 to 0.2.4

Reviewed changes

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

Show a summary per file
File Description
src/ds_platform_utils/shared/utils.py New utility function run_sql that executes SQL via execute_string and returns the last cursor
src/ds_platform_utils/metaflow/write_audit_publish.py Updated warehouse selection and table preview fetching to use run_sql
src/ds_platform_utils/metaflow/pandas.py Refactored publish_pandas and query_pandas_from_snowflake to use run_sql for all SQL execution
src/ds_platform_utils/metaflow/get_snowflake_connection.py Changed session configuration queries to use run_sql instead of cursor.execute
src/ds_platform_utils/_snowflake/write_audit_publish.py Updated run_query, run_audit_query, and fetch_table_preview to use run_sql with None checks
pyproject.toml Version increment to 0.2.4

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

@avr2002 avr2002 merged commit ebd0fbf into main Dec 4, 2025
10 checks passed
@avr2002 avr2002 deleted the feat/change-execute-to-execute-string branch December 4, 2025 07:20
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.

3 participants