MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _fetch_setting

Method _fetch_setting

lib/sqlalchemy/dialects/mysql/base.py:3709–3726  ·  view source on GitHub ↗
(
        self, connection: Connection, setting_name: str
    )

Source from the content-addressed store, hash-verified

3707 return parser.parse(sql, charset)
3708
3709 def _fetch_setting(
3710 self, connection: Connection, setting_name: str
3711 ) -> Optional[str]:
3712 charset = self._connection_charset
3713
3714 if self.server_version_info and self.server_version_info < (5, 6):
3715 sql = "SHOW VARIABLES LIKE '%s'" % setting_name
3716 fetch_col = 1
3717 else:
3718 sql = "SELECT @@%s" % setting_name
3719 fetch_col = 0
3720
3721 show_var = connection.exec_driver_sql(sql)
3722 row = self._compat_first(show_var, charset=charset)
3723 if not row:
3724 return None
3725 else:
3726 return cast(Optional[str], row[fetch_col])
3727
3728 def _detect_charset(self, connection: Connection) -> str:
3729 raise NotImplementedError()

Callers 3

_detect_casingMethod · 0.95
_detect_sql_modeMethod · 0.95
_detect_charsetMethod · 0.80

Calls 3

_compat_firstMethod · 0.95
castFunction · 0.85
exec_driver_sqlMethod · 0.45

Tested by

no test coverage detected