MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / ck

Method ck

lib/sqlalchemy/testing/suite/test_ddl.py:369–395  ·  view source on GitHub ↗
(self, metadata, connection)

Source from the content-addressed store, hash-verified

367 return actual_name, reflected_name
368
369 def ck(self, metadata, connection):
370 convention = {
371 "ck": "check_constraint_%(table_name)s"
372 + (
373 "_".join(
374 "".join(random.choice("abcdef") for j in range(30))
375 for i in range(10)
376 )
377 ),
378 }
379 metadata.naming_convention = convention
380
381 cons = CheckConstraint("some_long_column_name > 5")
382 Table(
383 "a_things_with_stuff",
384 metadata,
385 Column("id_long_column_name", Integer, primary_key=True),
386 Column("some_long_column_name", Integer),
387 cons,
388 )
389 actual_name = cons.name
390
391 metadata.create_all(connection)
392 insp = inspect(connection)
393 ck = insp.get_check_constraints("a_things_with_stuff")
394 reflected_name = ck[0]["name"]
395 return actual_name, reflected_name
396
397 @testing.combinations(
398 ("fk",),

Callers

nothing calls this directly

Calls 7

inspectFunction · 0.90
CheckConstraintClass · 0.85
create_allMethod · 0.80
TableFunction · 0.50
ColumnFunction · 0.50
joinMethod · 0.45
get_check_constraintsMethod · 0.45

Tested by

no test coverage detected