Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Description is reused for all result sets #310

Open
Assignees
jahnvi480
Labels
triage neededFor new issues, not triaged yet.
@MeinAccount

Description

@MeinAccount

Describe the bug

When running sql that produces multiple result sets, theCursor.description is not updated when callingCursor.nextset(). In particular, when the first result set doesn't produce rows (like an update without output clause), it is not possible to fetch rows of the 2nd result set.

curs.execute("""update ... set ...;update ... set ... output inserted.*;""")curs.nextset()# no rows from the first setprint(rows.fetchall())# this will raise
Exception message: TypeError: 'NoneType' object is not iterableStack trace:  File "/***/python3.12/site-packages/mssql_python/cursor.py", line 1821, in fetchall    raise e  File "/***/python3.12/site-packages/mssql_python/cursor.py", line 1818, in fetchall    return [Row(self, self.description, row_data, column_map) for row_data in rows_data]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/***/python3.12/site-packages/mssql_python/row.py", line 45, in __init__    for i, col_desc in enumerate(description):                       ^^^^^^^^^^^^^^^^^^^^^^

The provided code works using PyODBC. For that particular case, it is of course possible to split into twoCursor.execute calls. This is a reduced test-case where SQL-table variables are used, which requires the singleexecute-Call.

Further technical details

Python version: 3.12 usingmssql-python==0.13.1
SQL Server version: Azure SQL
Operating system: Ubuntu 24.04 on WSL2

Metadata

Metadata

Assignees

Labels

triage neededFor new issues, not triaged yet.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp