-
Notifications
You must be signed in to change notification settings - Fork 1
Add sqlExecute
#30
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
Closed
Closed
Add sqlExecute
#30
Conversation
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
Signed-off-by: Edmund Miller <[email protected]>
…ements Signed-off-by: Edmund Miller <[email protected]>
…SQL execution logic - Removed the executeUpdate parameter from QueryHandler and ChannelSqlExtension. - Simplified SQL execution by directly executing queries without checking for DDL or UPDATE statements. Signed-off-by: Edmund Miller <[email protected]>
- Introduced `execute` and `executeUpdate` methods for executing SQL statements without returning a result set. - Added parameter validation and error handling for database connections. - Implemented SQL statement normalization to ensure proper execution. Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
- Added tests for DDL and DML operations, including table creation, updates, and deletions. - Implemented error handling tests for invalid SQL statements and database configurations. - Ensured proper handling of statement normalization. Signed-off-by: Edmund Miller <[email protected]>
- Changed `execute` and `executeUpdate` methods from static to instance methods, allowing for better integration with session management. - Updated test cases to reflect the new method calls and ensure proper session initialization. Signed-off-by: Edmund Miller <[email protected]>
- Changed the database configuration from in-memory to file-based for persistence. - Updated SQL statements to use uppercase for table and column names for consistency. - Enhanced logging to include results of table creation and updates. Signed-off-by: Edmund Miller <[email protected]>
…ions - Added try-catch blocks around `setAutoCommit` and `commit` methods to handle exceptions for databases that do not support these operations. - Improved logging to provide feedback when default behaviors are used due to unsupported operations. Signed-off-by: Edmund Miller <[email protected]>
- Added a new `.envrc` file to manage environment variables for database connections. Signed-off-by: Edmund Miller <[email protected]>
- Renamed the `execute` function to `sqlExecute` for clarity and consistency. - Updated all references in the README, example scripts, and tests to reflect the new function name. - Enhanced documentation to provide clearer usage examples for SQL execution functions. Signed-off-by: Edmund Miller <[email protected]> Co-authored-by: Edmund Miller <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
- Enhanced logging in examples to provide feedback on the number of affected rows and results of DDL operations. Signed-off-by: Edmund Miller <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
- Modified the `sqlExecute` method to return a map containing success status, affected rows, and error messages for both DDL and DML operations. - Updated documentation to reflect the new return structure. - Adjusted unit tests to validate the new response format and ensure proper handling of success and error cases. Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
Co-authored-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Edmund Miller <[email protected]>
Signed-off-by: Edmund Miller <[email protected]>
pditommaso
reviewed
May 27, 2025
pditommaso
reviewed
May 27, 2025
pditommaso
reviewed
May 27, 2025
…ations - Enhanced the InsertHandler to provide fallbacks for unsupported operations like setObject and executeBatch, specifically for drivers such as Databricks. - Added detailed logging to inform users when operations are skipped or when fallbacks are attempted, improving debuggability. - Ensured that exceptions are thrown with clear messages when both primary and fallback methods fail, preventing silent failures. nextflow-io#30 (comment) Co-authored-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Edmund Miller <[email protected]>
pditommaso
reviewed
May 27, 2025
pditommaso
reviewed
May 27, 2025
Try this patch.txt Also make future PR directly into this repo, instead of using your fork . |
…Handler Co-authored-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Edmund Miller <[email protected]>
Done! Nice work! |
It turns out that |
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.
This pull request introduces a new SQL execution function (
sqlExecute
) to thenf-sqldb
plugin, enhances database compatibility by gracefully handling unsupported operations, and provides an example script to demonstrate the new functionality.New SQL Execution Functionality:
sqlExecute
function to execute SQL statements that do not return a result set (e.g., DDL and DML operations). It provides detailed responses, including success status and affected rows for DML statements.examples/sql-execution/main.nf
) and configuration (examples/sql-execution/nextflow.config
) to demonstrate the usage ofsqlExecute
for creating, updating, deleting, and querying data. [1] [2]Database Compatibility Enhancements:
InsertHandler
to handle unsupported operations (e.g.,setAutoCommit
,setObject
,commit
,executeBatch
) with fallback behavior, improving compatibility with drivers like Databricks. [1] [2] [3] [4] [5]Build and Installation Updates:
version
variable in theMakefile
to dynamically fetch the plugin version and a newinstall
target for local plugin installation. [1] [2]Minor Code Enhancements:
QueryHandler
to normalize SQL statements before execution for consistency.