MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / ix

Method ix

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

Source from the content-addressed store, hash-verified

310 return actual_name, reflected_name
311
312 def ix(self, metadata, connection):
313 convention = {
314 "ix": "index_%(table_name)s_"
315 "%(column_0_N_name)s"
316 + (
317 "_".join(
318 "".join(random.choice("abcdef") for j in range(30))
319 for i in range(10)
320 )
321 ),
322 }
323 metadata.naming_convention = convention
324
325 a = Table(
326 "a_things_with_stuff",
327 metadata,
328 Column("id_long_column_name", Integer, primary_key=True),
329 Column("id_another_long_name", Integer),
330 )
331 cons = Index(None, a.c.id_long_column_name, a.c.id_another_long_name)
332 actual_name = cons.name
333
334 metadata.create_all(connection)
335 insp = inspect(connection)
336 ix = insp.get_indexes("a_things_with_stuff")
337 reflected_name = ix[0]["name"]
338 return actual_name, reflected_name
339
340 def uq(self, metadata, connection):
341 convention = {

Callers

nothing calls this directly

Calls 7

inspectFunction · 0.90
IndexClass · 0.85
create_allMethod · 0.80
TableFunction · 0.50
ColumnFunction · 0.50
joinMethod · 0.45
get_indexesMethod · 0.45

Tested by

no test coverage detected