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

Method initialize

lib/sqlalchemy/dialects/mysql/base.py:3156–3207  ·  view source on GitHub ↗
(self, connection: Connection)

Source from the content-addressed store, hash-verified

3154 ]
3155
3156 def initialize(self, connection: Connection) -> None:
3157 # this is driver-based, does not need server version info
3158 # and is fairly critical for even basic SQL operations
3159 self._connection_charset: Optional[str] = self._detect_charset(
3160 connection
3161 )
3162
3163 # call super().initialize() because we need to have
3164 # server_version_info set up. in 1.4 under python 2 only this does the
3165 # "check unicode returns" thing, which is the one area that some
3166 # SQL gets compiled within initialize() currently
3167 default.DefaultDialect.initialize(self, connection)
3168
3169 self._detect_sql_mode(connection)
3170 self._detect_ansiquotes(connection) # depends on sql mode
3171 self._detect_casing(connection)
3172 if self._server_ansiquotes:
3173 # if ansiquotes == True, build a new IdentifierPreparer
3174 # with the new setting
3175 self.identifier_preparer = self.preparer(
3176 self, server_ansiquotes=self._server_ansiquotes
3177 )
3178
3179 self.supports_sequences = (
3180 self.is_mariadb and self.server_version_info >= (10, 3)
3181 )
3182
3183 self.supports_for_update_of = (
3184 self._is_mysql and self.server_version_info >= (8,)
3185 )
3186
3187 self.use_mysql_for_share = (
3188 self._is_mysql and self.server_version_info >= (8, 0, 1)
3189 )
3190
3191 self._needs_correct_for_88718_96365 = self.server_version_info >= (
3192 8,
3193 ) and (self.server_version_info < (8, 0, 14) or self._casing == 2)
3194
3195 self.delete_returning = (
3196 self.is_mariadb and self.server_version_info >= (10, 0, 5)
3197 )
3198
3199 self.insert_returning = (
3200 self.is_mariadb and self.server_version_info >= (10, 5)
3201 )
3202
3203 self._requires_alias_for_on_duplicate_key = (
3204 self._is_mysql and self.server_version_info >= (8, 0, 20)
3205 )
3206
3207 self._warn_for_known_db_issues()
3208
3209 def _warn_for_known_db_issues(self) -> None:
3210 if self.is_mariadb:

Callers

nothing calls this directly

Calls 5

_detect_charsetMethod · 0.95
_detect_sql_modeMethod · 0.95
_detect_ansiquotesMethod · 0.95
_detect_casingMethod · 0.95

Tested by

no test coverage detected