Skip to content

request timeout not working #291

@lstorme

Description

@lstorme

Describe the bug

A clear and concise description of what the bug is.

If you are seeing an exception, include the full exceptions details (message and stack trace).

10
Done:

To reproduce

Include a complete code listing (or project/solution) that we can run to reproduce the issue.

Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.

Use step from https://github.com/microsoft/mssql-python/wiki/Connection


    conn = mssql_python.connect(create_dsn(), timeout=10)
    print(conn.timeout)  # 10

    # Change timeout dynamically
    conn.timeout = 10

    cursor = conn.cursor()
    try:
        # Query that might run longer than 10 seconds
        cursor.execute("WAITFOR DELAY '00:00:15'")
    except mssql_python.OperationalError as e:
        print("Query timed out:", e)
    print("Done:")

Expected behavior

A clear and concise description of what you expected to happen.
-> should see Query timed out...
-> no exception raised

Further technical details

Python version: 3.12
SQL Server version: (e.g. SQL Server 2022)
Operating system: RedHat 8

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