MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / make_column

Method make_column

test/orm/declarative/test_basic.py:3329–3369  ·  view source on GitHub ↗
(assign_col_name)

Source from the content-addressed store, hash-verified

3327 return name
3328
3329 def make_column(assign_col_name):
3330 use_key = random.randint(1, 3) == 1
3331 use_name = random.randint(1, 3) == 1
3332
3333 args = []
3334 kw = {}
3335 name = col_name = make_name()
3336
3337 if use_name:
3338 use_different_name = random.randint(1, 3) != 3
3339 if use_different_name:
3340 col_name = make_name()
3341
3342 args.append(col_name)
3343 elif assign_col_name:
3344 args.append(col_name)
3345
3346 if use_key:
3347 kw["key"] = name
3348 expected_c_name = name
3349 else:
3350 expected_c_name = col_name
3351
3352 args.append(Integer)
3353
3354 use_mapped_column = is_declarative and random.randint(1, 2) == 1
3355
3356 if use_mapped_column:
3357 col = mapped_column(*args, **kw)
3358 else:
3359 col = Column(*args, **kw)
3360
3361 use_explicit_property = (
3362 not use_mapped_column and random.randint(1, 6) == 1
3363 )
3364 if use_explicit_property:
3365 col_prop = column_property(col)
3366 else:
3367 col_prop = col
3368
3369 return name, expected_c_name, col, col_prop
3370
3371 assign_col_name = mapping_style.classical_mapping
3372

Callers

nothing calls this directly

Calls 4

mapped_columnFunction · 0.90
ColumnClass · 0.90
column_propertyFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected