'Connects to a database as set in `site_config.json`.'

def connect(self):

    warnings.filterwarnings(u'ignore', category=MySQLdb.Warning)
    usessl = 0
    if (frappe.conf.db_ssl_ca and frappe.conf.db_ssl_cert and frappe.conf.db_ssl_key):
        usessl = 1
        self.ssl = {u'ca': frappe.conf.db_ssl_ca, u'cert': frappe.conf.db_ssl_cert, u'key': frappe.conf.db_ssl_key}
    if usessl:
        self._conn = MySQLdb.connect(user=self.user, host=self.host, passwd=self.password, use_unicode=True, charset=u'utf8mb4', ssl=self.ssl)
    else:
        self._conn = MySQLdb.connect(user=self.user, host=self.host, passwd=self.password, use_unicode=True, charset=u'utf8mb4')
    self._conn.converter[246] = float
    self._conn.converter[12] = get_datetime
    self._conn.encoders[UnicodeWithAttrs] = self._conn.encoders[text_type]
    self._conn.encoders[DateTimeDeltaType] = self._conn.encoders[binary_type]
    MYSQL_OPTION_MULTI_STATEMENTS_OFF = 1
    self._conn.set_server_option(MYSQL_OPTION_MULTI_STATEMENTS_OFF)
    self._cursor = self._conn.cursor()
    if (self.user != u'root'):
        self.use(self.user)
    frappe.local.rollback_observers = []
