MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / pyodbc_fast_executemany

Method pyodbc_fast_executemany

test/requirements.py:1840–1867  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1838
1839 @property
1840 def pyodbc_fast_executemany(self):
1841 def has_fastexecutemany(config):
1842 if not against(config, "mssql+pyodbc") and not against(
1843 config, "mssql+aioodbc"
1844 ):
1845 return False
1846 if config.db.dialect._dbapi_version() < (4, 0, 19):
1847 return False
1848 with config.db.connect() as conn:
1849 driver_connection = conn.connection.driver_connection
1850
1851 # for aioodbc, instead of trying to await, just cheat and
1852 # use the pyodbc connection
1853 if hasattr(
1854 driver_connection, "__module__"
1855 ) and driver_connection.__module__.startswith("aioodbc"):
1856 driver_connection = driver_connection._conn
1857
1858 drivername = driver_connection.getinfo(
1859 config.db.dialect.dbapi.SQL_DRIVER_NAME
1860 )
1861 # on linux this is something like 'libmsodbcsql-13.1.so.9.2'.
1862 # on Windows this is something like 'msodbcsql17.dll'.
1863 return "msodbc" in drivername
1864
1865 return only_if(
1866 has_fastexecutemany, "only on pyodbc > 4.0.19 w/ msodbc driver"
1867 )
1868
1869 @property
1870 def selectone(self):

Callers

nothing calls this directly

Calls 1

only_ifFunction · 0.90

Tested by

no test coverage detected