Feat/change execute to execute string#14
Merged
amitvikramraj merged 21 commits intomainfrom Dec 4, 2025
Merged
Conversation
… queries using conn.execute_string .instead
There was a problem hiding this comment.
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_sqlutility function insrc/ds_platform_utils/shared/utils.pythat wrapsexecute_stringand returns the last cursor - Replaced all
cursor.execute()calls withrun_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.
…cal shared utility `run_sql` utility added unit tests
…w tests to resolve test failures due to pylint
…g SQL queries and added return df which I forgot before and was encountring Nonetype error
…h , publish_pandas and query_pandas_from_snowflake
…vate sub module making the method also private and deleted shared directory , also moved test__utils.py to snowflake/ in functional tests
…low current object
amitvikramraj
approved these changes
Dec 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
cursor.execute()withrun_sqlutility for executing SQL queries usingconn.execute_stringinstead.