MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / get_column_specification

Method get_column_specification

lib/sqlalchemy/sql/compiler.py:7390–7417  ·  view source on GitHub ↗
(
        self, column: Column[Any], **kwargs: Any
    )

Source from the content-addressed store, hash-verified

7388 )
7389
7390 def get_column_specification(
7391 self, column: Column[Any], **kwargs: Any
7392 ) -> str:
7393 colspec = (
7394 self.preparer.format_column(column)
7395 + " "
7396 + self.dialect.type_compiler_instance.process(
7397 column.type, type_expression=column
7398 )
7399 )
7400 default = self.get_column_default_string(column)
7401 if default is not None:
7402 colspec += " DEFAULT " + default
7403
7404 if column.computed is not None:
7405 colspec += " " + self.process(column.computed)
7406
7407 if (
7408 column.identity is not None
7409 and self.dialect.supports_identity_columns
7410 ):
7411 colspec += " " + self.process(column.identity)
7412
7413 if not column.nullable and (
7414 not column.identity or not self.dialect.supports_identity_columns
7415 ):
7416 colspec += " NOT NULL"
7417 return colspec
7418
7419 def create_table_suffix(self, table: Table) -> str:
7420 return ""

Callers 11

visit_create_columnMethod · 0.95
test_serial_integerMethod · 0.45
_column_specMethod · 0.45
test_booleanMethod · 0.45
test_numericMethod · 0.45
test_charMethod · 0.45
test_datesMethod · 0.45
test_moneyMethod · 0.45
test_binaryMethod · 0.45
test_datesMethod · 0.45
colspecFunction · 0.45

Calls 3

format_columnMethod · 0.80
processMethod · 0.45

Tested by 10

test_serial_integerMethod · 0.36
_column_specMethod · 0.36
test_booleanMethod · 0.36
test_numericMethod · 0.36
test_charMethod · 0.36
test_datesMethod · 0.36
test_moneyMethod · 0.36
test_binaryMethod · 0.36
test_datesMethod · 0.36
colspecFunction · 0.36