MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / _expect_downgrade_warnings

Method _expect_downgrade_warnings

test/sql/test_insert_exec.py:1226–1278  ·  view source on GitHub ↗
(
        self,
        *,
        warn_for_downgrades,
        sort_by_parameter_order,
        separate_sentinel=False,
        server_autoincrement=False,
        client_side_pk=False,
        autoincrement_is_sequence=False,
        connection=None,
        expect_warnings_override=None,
    )

Source from the content-addressed store, hash-verified

1224 __requires__ = ("insert_returning",)
1225
1226 def _expect_downgrade_warnings(
1227 self,
1228 *,
1229 warn_for_downgrades,
1230 sort_by_parameter_order,
1231 separate_sentinel=False,
1232 server_autoincrement=False,
1233 client_side_pk=False,
1234 autoincrement_is_sequence=False,
1235 connection=None,
1236 expect_warnings_override=None,
1237 ):
1238 if connection:
1239 dialect = connection.dialect
1240 else:
1241 dialect = testing.db.dialect
1242
1243 if (
1244 expect_warnings_override is not False
1245 and sort_by_parameter_order
1246 and warn_for_downgrades
1247 and dialect.use_insertmanyvalues
1248 ):
1249 if (
1250 not separate_sentinel
1251 and (
1252 server_autoincrement
1253 and (
1254 not (
1255 dialect.insertmanyvalues_implicit_sentinel # noqa: E501
1256 & InsertmanyvaluesSentinelOpts.ANY_AUTOINCREMENT
1257 )
1258 or (
1259 autoincrement_is_sequence
1260 and not (
1261 dialect.insertmanyvalues_implicit_sentinel # noqa: E501
1262 & InsertmanyvaluesSentinelOpts.SEQUENCE
1263 )
1264 )
1265 )
1266 )
1267 or (
1268 not separate_sentinel
1269 and not server_autoincrement
1270 and not client_side_pk
1271 )
1272 or (expect_warnings_override is True)
1273 ):
1274 return expect_warnings(
1275 "Batches were downgraded",
1276 )
1277
1278 return contextlib.nullcontext()
1279
1280 @testing.variation
1281 def sort_by_parameter_order(self):

Calls 1

expect_warningsFunction · 0.90

Tested by

no test coverage detected