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

Method _detect_casing

lib/sqlalchemy/dialects/mysql/base.py:3731–3753  ·  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

3729 raise NotImplementedError()
3730
3731 def _detect_casing(self, connection: Connection) -> int:
3732 """Sniff out identifier case sensitivity.
3733
3734 Cached per-connection. This value can not change without a server
3735 restart.
3736
3737 """
3738 # https://dev.mysql.com/doc/refman/en/identifier-case-sensitivity.html
3739
3740 setting = self._fetch_setting(connection, "lower_case_table_names")
3741 if setting is None:
3742 cs = 0
3743 else:
3744 # 4.0.15 returns OFF or ON according to [ticket:489]
3745 # 3.23 doesn't, 4.0.27 doesn't..
3746 if setting == "OFF":
3747 cs = 0
3748 elif setting == "ON":
3749 cs = 1
3750 else:
3751 cs = int(setting)
3752 self._casing = cs
3753 return cs
3754
3755 def _detect_collations(self, connection: Connection) -> Dict[str, str]:
3756 """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