MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / compile_

Method compile_

test/sql/test_metadata.py:4747–4768  ·  view source on GitHub ↗
(element, compiler, **kw)

Source from the content-addressed store, hash-verified

4745 def test_custom_create(self):
4746 @compiles(schema.CreateColumn)
4747 def compile_(element, compiler, **kw):
4748 column = element.element
4749
4750 if "special" not in column.info:
4751 return compiler.visit_create_column(element, **kw)
4752
4753 text = "%s SPECIAL DIRECTIVE %s" % (
4754 column.name,
4755 compiler.type_compiler.process(column.type),
4756 )
4757 default = compiler.get_column_default_string(column)
4758 if default is not None:
4759 text += " DEFAULT " + default
4760
4761 if not column.nullable:
4762 text += " NOT NULL"
4763
4764 if column.constraints:
4765 text += " ".join(
4766 compiler.process(const) for const in column.constraints
4767 )
4768 return text
4769
4770 t = Table(
4771 "mytable",

Callers

nothing calls this directly

Calls 4

visit_create_columnMethod · 0.80
processMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected