Source code for pystratum_mysql.MySqlConnector

import abc

from mysql.connector import MySQLConnection


[docs]class MySqlConnector: """ Interface for classes for connecting to a MySql instances. """ # ------------------------------------------------------------------------------------------------------------------
[docs] @abc.abstractmethod def connect(self) -> MySQLConnection: """ Connects to the MySql instance. """ raise NotImplementedError()
# ------------------------------------------------------------------------------------------------------------------
[docs] @abc.abstractmethod def disconnect(self) -> None: """ Disconnects from the MySql instance. """ raise NotImplementedError()
# ------------------------------------------------------------------------------------------------------------------
[docs] @abc.abstractmethod def is_alive(self) -> bool: """ Returns whether Python is (still) connected to a MySQL or MariaDB instance. :rtype: bool """ raise NotImplementedError()
# ----------------------------------------------------------------------------------------------------------------------