Enumeration for the :paramref:`.MetaData.create_all.checkfirst` parameter passed to methods like :meth:`.MetaData.create_all`, :meth:`.MetaData.drop_all`, :meth:`.Table.create`, :meth:`.Table.drop` and others. This enumeration indicates what kinds of objects should be "checked"
| 1298 | |
| 1299 | |
| 1300 | class CheckFirst(Flag): |
| 1301 | """Enumeration for the :paramref:`.MetaData.create_all.checkfirst` |
| 1302 | parameter passed to methods like :meth:`.MetaData.create_all`, |
| 1303 | :meth:`.MetaData.drop_all`, :meth:`.Table.create`, :meth:`.Table.drop` and |
| 1304 | others. |
| 1305 | |
| 1306 | This enumeration indicates what kinds of objects should be "checked" |
| 1307 | with a separate query before emitting CREATE or DROP for that object. |
| 1308 | |
| 1309 | Can use ``CheckFirst(bool_value)`` to convert from a boolean value. |
| 1310 | |
| 1311 | .. versionadded:: 2.1 |
| 1312 | |
| 1313 | """ |
| 1314 | |
| 1315 | NONE = 0 # equivalent to False |
| 1316 | """No items should be checked""" |
| 1317 | |
| 1318 | # avoid 1 so that bool True doesn't match by value |
| 1319 | TABLES = 2 |
| 1320 | """Check for tables""" |
| 1321 | |
| 1322 | VIEWS = auto() |
| 1323 | """Check for views""" |
| 1324 | |
| 1325 | INDEXES = auto() |
| 1326 | """Check for indexes""" |
| 1327 | |
| 1328 | SEQUENCES = auto() |
| 1329 | """Check for sequences""" |
| 1330 | |
| 1331 | TYPES = auto() |
| 1332 | """Check for custom datatypes that are created server-side |
| 1333 | |
| 1334 | This is currently used by PostgreSQL. |
| 1335 | |
| 1336 | """ |
| 1337 | |
| 1338 | ALL = TABLES | VIEWS | INDEXES | SEQUENCES | TYPES # equivalent to True |
| 1339 | |
| 1340 | @classmethod |
| 1341 | def _missing_(cls, value: object) -> Any: |
| 1342 | if isinstance(value, bool): |
| 1343 | return cls.ALL if value else cls.NONE |
| 1344 | return super()._missing_(value) |
| 1345 | |
| 1346 | |
| 1347 | class SchemaGenerator(InvokeCreateDDLBase): |
no outgoing calls