Skip to content

cursor.bulkcopy() ignores connection timeout - pycore connection hardcodes 15s #626

@bewithgaurav

Description

@bewithgaurav

Summary

This is a known gap, opening up issue in case someone faces this - registering as a bug.
The connection timeout parameter is not forwarded to the mssql-py-core TDS connection that cursor.bulkcopy() opens internally. mssql-py-core/src/connection.rs defaults to 15 seconds, and there is currently no way for users to override this value from Python.

Current behavior

  1. connect(timeout=X) sets the ODBC query timeout. This applies to execute, fetch, etc. but has no effect on the separate connection that cursor.bulkcopy() opens through pycore.

  2. connstr_to_pycore_params() in helpers.py drops connect_timeout from the key map, so it never reaches pycore.

  3. The pycore side defaults to 15 seconds when connect_timeout is not provided. Users have no way to override this.

Expected behavior

The connection timeout should be forwarded from the Python side through connstr_to_pycore_params() to mssql_py_core.PyCoreConnection, allowing users to control how long the Rust TDS connection waits when establishing a connection to SQL Server.

Possibly related

This may be related to #595 (random "Timeout while connecting" errors during concurrent bulk loads on 1.7.1). The hardcoded 15-second timeout may be insufficient under heavy concurrent load, and users currently cannot increase it.

Metadata

Metadata

Assignees

Labels

area: bulk-copyIssues in cursor.bulkcopy()bugSomething isn't workinginADOtriage doneIssues that are triaged by dev team and are in investigation.under development

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions