U au@sdZddlZddlmZddlmZddlmZddlmZdd lm Z Gd d d ej Z Gd d d eZ GdddeZ e ZdS)aL .. dialect:: mssql+pymssql :name: pymssql :dbapi: pymssql :connectstring: mssql+pymssql://:@/?charset=utf8 pymssql is a Python module that provides a Python DBAPI interface around `FreeTDS `_. .. note:: pymssql is currently not included in SQLAlchemy's continuous integration (CI) testing. Modern versions of this driver worked very well with SQL Server and FreeTDS from Linux and were highly recommended. However, pymssql is currently unmaintained and has fallen behind the progress of the Microsoft ODBC driver in its support for newer features of SQL Server. The latest official release of pymssql at the time of this document is version 2.1.4 (August, 2018) and it lacks support for: 1. table-valued parameters (TVPs), 2. ``datetimeoffset`` columns using timezone-aware ``datetime`` objects (values are sent and retrieved as strings), and 3. encrypted connections (e.g., to Azure SQL), when pymssql is installed from the pre-built wheels. Support for encrypted connections requires building pymssql from source, which can be a nuisance, especially under Windows. The above features are all supported by mssql+pyodbc when using Microsoft's ODBC Driver for SQL Server (msodbcsql), which is now available for Windows, (several flavors of) Linux, and macOS. N) MSDialect)MSIdentifierPreparer) processors)types)utilc@seZdZddZdS)_MSNumeric_pymssqlcCs |js tjStj|||SdSN)Z asdecimalrZto_floatsqltypesNumericresult_processor)selfdialecttype_rbC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\dialects\mssql\pymssql.pyr 4sz#_MSNumeric_pymssql.result_processorN)__name__ __module__ __qualname__r rrrrr 3sr cseZdZfddZZS)MSIdentifierPreparer_pymssqlcstt||d|_dS)NF)superr__init__Z_double_percents)rr __class__rrr<sz%MSIdentifierPreparer_pymssql.__init__)rrrr __classcell__rrrrr;srcsleZdZdZdZdZeZe e j e j ee je jiZ eddZddZddZd d Zfd d ZZS) MSDialect_pymssqlTpymssqlcCsJtd}tdd|jdD}|dkr4dd|_|dkrFtd |S) Nrcss|]}t|VqdSr int.0xrrr Ssz*MSDialect_pymssql.dbapi...)rrcSst|dr|St|S)Ndecode)hasattrstr)r"rrrVz)MSDialect_pymssql.dbapi..)rzIThe pymssql dialect expects at least the 1.0 series of the pymssql DBAPI.) __import__tuple __version__splitBinaryrwarn)clsmoduleZ client_verrrrdbapiOs zMSDialect_pymssql.dbapicCsD|d}td|}|r.rr%r)Zexec_driver_sqlZscalarrematchr,group)r connectionversmrrr_get_server_version_info_s  z*MSDialect_pymssql._get_server_version_infocCsL|jdd}||j|dd}|rDd|krDd|d|f|d<g|gS)Nuser)usernameporthostz%s:%s)Ztranslate_connect_argsupdatequerypop)rurloptsr>rrrcreate_connect_argsgs     z%MSDialect_pymssql.create_connect_argscCs dD]}|t|krdSqdS)N) z$Adaptive Server connection timed outz-Net-Lib error during Connection reset by peerz message 20003z Error 10054z"Not connected to any MS SQL serverzConnection is closedz message 20006z message 20017z message 20047TF)r()rer8cursormsgrrr is_disconnectos zMSDialect_pymssql.is_disconnectcs4|dkr|dn|dtt|||dS)NZ AUTOCOMMITTF)Z autocommitrrset_isolation_level)rr8levelrrrrJs   z%MSDialect_pymssql.set_isolation_level)rrrZsupports_statement_cacheZsupports_native_decimalZdriverrpreparerrZ update_copyrZcolspecsr r r ZFloat classmethodr3r;rErIrJrrrrrrCs r)__doc__r5baserrrrr rr r rrrrrrrs"     G