We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug In the documentation, https://bloomberg.github.io/python-comdb2/dbapi2.html#comdb2.dbapi2.Cursor.fetchall, it says it returns a list, but in vscode, when I do reveal_type, i get a Sequence.
a =cursor.execute(query, params).fetchall() reveal_type(a) # Type of "a" is "Sequence[Any]"Pylance
Expected behavior Either documentation should say it returns a Sequence, or a list should be returned.
Screenshots
Environment (please complete the following information):
I wanted to do two queries and append the result. But since it was a Sequence, pylance was complaining.
def get_unique_key_of_row(row: Any) -> str: return f'{row['unique_key_1']}_{row['unique_key_2']}' def get_rows_util(param: str) -> Sequence[Any]: query = "select * from table where param = %(param)s" connection = get_connection() with closing(connection): cursor = connection.cursor() return cursor.execute(query, {"param": param}).fetchall() def process_some_logic() -> List[Any]: records_1 = get_rows_util("dog") records1_key_set: Set[str] = {get_unique_key_of_row(x) for x in records_1} records_2_filtered = [x for x in get_rows_util("cat") if get_unique_key_of_row(x) not in records1_key_set] return records_1 + records_2_filtered ''' Operator "+" not supported for types "Sequence[Any]" and "list[Any]"PylancereportOperatorIssue Return type is unknownPylancereportUnknownVariableType '''
The text was updated successfully, but these errors were encountered:
Changing the annotation to say that we return a list seems fair enough. Want to send a PR?
Sorry, something went wrong.
Yes. Will Get right to it :)
fetchmany
fetchall
Sequence
Successfully merging a pull request may close this issue.
Describe the bug
In the documentation, https://bloomberg.github.io/python-comdb2/dbapi2.html#comdb2.dbapi2.Cursor.fetchall, it says it returns a list, but in vscode, when I do reveal_type, i get a Sequence.
Expected behavior
Either documentation should say it returns a Sequence, or a list should be returned.
Screenshots

Environment (please complete the following information):
Usecase
I wanted to do two queries and append the result. But since it was a Sequence, pylance was complaining.
The text was updated successfully, but these errors were encountered: