Add asyncio support, cursor enhancements, test runner refactor and documentation#1060
Open
Earammak wants to merge 1 commit intoibmdb:masterfrom
Open
Add asyncio support, cursor enhancements, test runner refactor and documentation#1060Earammak wants to merge 1 commit intoibmdb:masterfrom
Earammak wants to merge 1 commit intoibmdb:masterfrom
Conversation
…cumentation Signed-off-by: Earamma K <ek@rocketsoftware.com>
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.
Added asyncio support to python-ibmdb, enabling async/await usage for DB2 database operations via the DB-API 2.0 layer (ibm_db_dbi). All async support uses asyncio.to_thread() to offload blocking CLI calls to a thread pool — no changes to the C extension were required.
Enhancements to Cursor:
Added prepare(operation) to pre‑compile SQL statements for later execution.
Introduced bind_param(index, value, …) for binding parameters to prepared statements.
New fetch_callproc() method to retrieve stored procedure output parameters.
New fetch_tuple() method to fetch rows as tuples.
Updated execute() to support invocation without arguments after using prepare() and bind_param().
Test Runner Improvements (ibmdb_tests.py)
Refactored runner with CLI flags:
--async runs only async tests
--sync runs only sync tests
--test runs a single test file
Added _load_async_tests() to discover and execute tests from asyncio_testsuite.
Default behavior runs both sync and async suites together.
Legacy support for SINGLE_PYTHON_TEST environment variable retained.
Bug Fixes (testfunctions.py):
Fixed operator precedence in assert_expect() / assert_expectf() to ensure consistent behavior on z/OS and OS/390.
Path‑independent matching with os.path.basename() instead of hardcoded prefixes.
Replaced fragile manual regex escaping with re.escape(), removing Python version checks.
DSN connection now supports uncataloged databases when config.hostname is set.
Db2connect.enter() now correctly passes stored credentials to ibm_db.connect().
Updated entry points from python tests.py to python ibmdb_tests.py in run_all_tests and run_individual_tests.
Documentation:
ASYNC_APIs_WIKI.md: Comprehensive API reference with signatures, parameters, return values, and usage examples for all async APIs.
README.md: Added link to async API documentation.
Consolidated and updated Testing section with new CLI flags (--async, --sync, --test ), including usage examples for running sync, async, or single tests.