MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / make_column

Method make_column

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

Source from the content-addressed store, hash-verified

3257 return name
3258
3259 def make_column(assign_col_name):
3260 use_key = random.randint(1, 3) == 1
3261 use_name = random.randint(1, 3) == 1
3262
3263 args = []
3264 kw = {}
3265 name = col_name = make_name()
3266
3267 if use_name:
3268 use_different_name = random.randint(1, 3) != 3
3269 if use_different_name:
3270 col_name = make_name()
3271
3272 args.append(col_name)
3273 elif assign_col_name:
3274 args.append(col_name)
3275
3276 if use_key:
3277 kw["key"] = name
3278 expected_c_name = name
3279 else:
3280 expected_c_name = col_name
3281
3282 args.append(Integer)
3283
3284 use_mapped_column = is_declarative and random.randint(1, 2) == 1
3285
3286 if use_mapped_column:
3287 col = mapped_column(*args, **kw)
3288 else:
3289 col = Column(*args, **kw)
3290
3291 use_explicit_property = (
3292 not use_mapped_column and random.randint(1, 6) == 1
3293 )
3294 if use_explicit_property:
3295 col_prop = column_property(col)
3296 else:
3297 col_prop = col
3298
3299 return name, expected_c_name, col, col_prop
3300
3301 assign_col_name = mapping_style.classical_mapping
3302

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