-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/change execute to execute string #14
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
Conversation
… queries using conn.execute_string .instead
There was a problem hiding this 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_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
Replace
cursor.execute()withrun_sqlutility for executing SQL queries usingconn.execute_stringinstead.