Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_detection_by_error_code(self):
from hdbcli.dbapi import Error
dialect = testing.db.dialect
assert dialect.is_disconnect(Error(-10709, 'Connect failed'), None, None)
https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.02/en-US/ee592e89dcce4480a99571a4ae7a702f.html
Example:
To avoid automatic reconnection set RECONNECT='FALSE' as parameter
"""
self._logger.info('connecting to SAP HANA database at %s:%s', host, port)
self.__properties = kwargs
try:
self._connection = dbapi.connect(
address=host,
port=port,
#user=kwargs.get('user'),
#password=kwargs.get('password'),
**self.__properties
)
except dbapi.Error as err:
raise base_connector.ConnectionError('connection failed: {}'.format(err))
self._logger.info('connected successfully')