Skip to content

Conversation

@minhuinie
Copy link
Contributor

Description

Please briefly describe the code changes in this pull request.

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?

@minhuinie minhuinie requested a review from a team as a code owner August 11, 2025 10:23
@minhuinie minhuinie requested a review from Copilot August 11, 2025 10:23

This comment was marked as outdated.

Copy link
Contributor

@tomchon tomchon left a comment

Choose a reason for hiding this comment

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

LGTM

def setup_class(cls):
tdLog.debug("start to execute %s" % __file__)

def newcon(self, host, cfg):
Copy link
Contributor

Choose a reason for hiding this comment

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

使用默认的连接,按着 tdSql 的逻辑,提供一个 tdStmt2 的初始化实例。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

stmt.close()

# Test 2: Batch insert using stmt2
stmt = TDStmt2(conn)
Copy link
Contributor

Choose a reason for hiding this comment

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

使用默认的 tdStmt2 的实例,提两种绑定写入的方法,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@taosdata taosdata deleted a comment from Copilot AI Aug 12, 2025
@tomchon tomchon requested a review from Copilot August 13, 2025 02:58
Copy link
Contributor

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 pull request adds support for TDengine's stmt2 API in the test framework by introducing a new utility class TDStmt2 with comprehensive methods for prepared statement operations. The implementation provides a convenient interface for single row inserts, batch operations, and super table data binding with proper error handling and logging.

Key changes:

  • Introduces TDStmt2 utility class with method chaining support and context manager functionality
  • Adds comprehensive parameter binding methods for different use cases (single, batch, super table)
  • Integrates stmt2 functionality into the test framework's initialization process

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
test/new_test_framework/utils/stmt2.py New utility class implementing TDengine stmt2 API wrapper with prepare, bind, and execute methods
test/new_test_framework/utils/init.py Exports TDStmt2 class for framework-wide usage
test/conftest.py Initializes global tdStmt2 instance in test setup
test/cases/demo/test_stmt2.py Demo test case showcasing stmt2 API usage patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

if self.stmt:
try:
self.stmt.close()
except:
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

Using bare except: clause is discouraged as it catches all exceptions including system exit and keyboard interrupt. Consider catching specific exceptions or using except Exception: instead.

Suggested change
except:
except Exception:

Copilot uses AI. Check for mistakes.

class TDStmt2:
"""
TDengine Stmt2 utility class
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

There's a trailing space at the end of the docstring line.

Suggested change
TDengine Stmt2 utility class
TDengine Stmt2 utility class

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

import instance instead of class

@feici02 feici02 merged commit 06d71da into 3.0 Aug 14, 2025
4 of 7 checks passed
@minhuinie minhuinie deleted the newtest_3.0_nmh branch August 20, 2025 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants