Proper type hint of Cursor.execute parameters
Below function works fine but I get an error from Mypy saying parameters type, Optional[dict], is not compatible with Union[dict, list, tuple].
def dummy(cursor: Cursor, parameters: dict | None) -> None:
for row in cursor.execute("select current_date from dual", parameters):
print(row[0])
Given parameters defaults to None, I believe type hint should include None too.
I've pushed a patch that corrects this issue among others in the oracleb.Cursor and oracledb.AsyncCursor classes. If you are able to build from source you can verify that it works for you, too.
I've added a new subdirectory in the tests folder called stc where I can add additional type checking tests like this one. That will happen over time.
I built from source and verified It works. Thank you.
This was included in python-oracledb 2.5.0 which was just released.