Skip to content

Conversation

@wkrettek
Copy link

@wkrettek wkrettek commented Nov 7, 2025

Description

I created this to address #371. I'm still working through testing it but it seems to compile and run. Open to any feedback

Jira: https://jira.taosdata.com:18080/browse/TD-

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?
@gemini-code-assist
Copy link

Summary of Changes

Hello @wkrettek, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the concurrency of the taos-ws-py library by strategically releasing the Python Global Interpreter Lock (GIL) during various I/O-bound database operations. By wrapping potentially long-running calls like queries, executions, cursor creation, schemaless data insertion, and connection establishment with py.allow_threads(), the library ensures that other Python threads are not blocked. This leads to improved responsiveness and parallel execution in multi-threaded Python applications, directly addressing issue #371 by preventing blocking behavior during database interactions.

Highlights

  • GIL Release for Query Operations: The query and query_with_req_id methods now explicitly release the Python Global Interpreter Lock (GIL) using py.allow_threads() during the actual database query execution. This allows other Python threads to run concurrently while the Rust code is performing potentially long-running I/O operations.
  • GIL Release for Execute Operations: Similar to query operations, the execute and execute_with_req_id methods also release the GIL during their database execution phase, improving concurrency for these operations.
  • GIL Release for Cursor Creation: The cursor method, responsible for creating a new database cursor, now releases the GIL during the builder.build() call, which can involve network or resource-intensive setup.
  • GIL Release for Schemaless Data Insertion: The put method for inserting schemaless data now releases the GIL while performing the taos.put(&data) operation, preventing Python threads from being blocked during data writes.
  • GIL Release for Connection Establishment: The connect function, which establishes a new database connection, now releases the GIL during the builder.build() call, allowing other Python threads to proceed during connection setup.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly releases the Python GIL during blocking I/O operations, which should improve performance in multi-threaded applications. The changes are applied consistently across various methods like query, execute, and connect. I've included one suggestion to refactor some duplicated code in the Connection methods to improve maintainability.

@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.94%. Comparing base (550d24b) to head (bcc5244).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #372 +/- ## ======================================= Coverage 81.94% 81.94% ======================================= Files 24 24 Lines 3644 3644 ======================================= Hits 2986 2986 Misses 658 658 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants