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

The mssql_python module

Jahnvi Thakkar edited this pageSep 18, 2025 ·1 revision

This page documents theglobal attributes and functions available directly from themssql_python module. These apply across all connections and cursors created usingmssql_python.

Global Attributes (Read-Only)

AttributeValueDescription
apilevel"2.0"The DB API level supported (perPEP 249).
paramstyle"qmark"The parameter style used in SQL queries (e.g.,SELECT * FROM T WHERE id = ?).
threadsafety1Indicates that threads may share the module butnot connections.
lowercaseFalseIfTrue, column names returned from queries are automatically converted to lowercase.
decimal_separator"." (default)The character used when parsingNUMERIC/DECIMAL values. Initialized at import from locale, defaults to"." if unavailable.

Functions

get_settings()

Returns the global settings object.

importmssql_pythonsettings=mssql_python.get_settings()print(settings.lowercase)# Falseprint(settings.decimal_separator)# "."

setDecimalSeparator(separator)

Sets the decimal separator character used when parsingNUMERIC/DECIMAL values.

Args

  • separator (str): Must be a single non-whitespace, non-control character string.

Raises

  • ValueError: If the input is empty, longer than one character, whitespace, or a control character.
importmssql_python# Change separator to commamssql_python.setDecimalSeparator(",")

getDecimalSeparator()

Returns the current decimal separator.

importmssql_pythonsep=mssql_python.getDecimalSeparator()print(sep)# "."

pooling(max_size=100, idle_timeout=600, enabled=True)

Configures the connection pooling behavior.

Args

  • max_size (int): Maximum number of connections in the pool.
  • idle_timeout (int): Seconds before idle connections are closed.
  • enabled (bool): Enable (True) or disable (False) pooling.
importmssql_python# Enable pooling with defaultsmssql_python.pooling()# Enable pooling with custom valuesmssql_python.pooling(max_size=50,idle_timeout=300)# Disable poolingmssql_python.pooling(enabled=False)

⚠️ Security & Usage Notes

  • Be careful when changing thedecimal separator: setting it incorrectly may cause numeric parsing issues or inconsistent behavior across environments.
  • When enablingconnection pooling, ensure proper sizing ofmax_size andidle_timeout to avoid resource exhaustion or stale connections in long-running applications.
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp