MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _detect_casing

Method _detect_casing

lib/sqlalchemy/dialects/mysql/base.py:3675–3697  ·  view source on GitHub ↗

Sniff out identifier case sensitivity. Cached per-connection. This value can not change without a server restart.

(self, connection: Connection)

Source from the content-addressed store, hash-verified

3673 raise NotImplementedError()
3674
3675 def _detect_casing(self, connection: Connection) -> int:
3676 """Sniff out identifier case sensitivity.
3677
3678 Cached per-connection. This value can not change without a server
3679 restart.
3680
3681 """
3682 # https://dev.mysql.com/doc/refman/en/identifier-case-sensitivity.html
3683
3684 setting = self._fetch_setting(connection, "lower_case_table_names")
3685 if setting is None:
3686 cs = 0
3687 else:
3688 # 4.0.15 returns OFF or ON according to [ticket:489]
3689 # 3.23 doesn't, 4.0.27 doesn't..
3690 if setting == "OFF":
3691 cs = 0
3692 elif setting == "ON":
3693 cs = 1
3694 else:
3695 cs = int(setting)
3696 self._casing = cs
3697 return cs
3698
3699 def _detect_collations(self, connection: Connection) -> dict[str, str]:
3700 """Pull the active COLLATIONS list from the server.

Callers 3

initializeMethod · 0.95
_has_mysql_on_windowsMethod · 0.80

Calls 1

_fetch_settingMethod · 0.95

Tested by

no test coverage detected