MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / id_generator

Method id_generator

test/ext/test_horizontal_shard.py:60–68  ·  view source on GitHub ↗
(ctx)

Source from the content-addressed store, hash-verified

58 )
59
60 def id_generator(ctx):
61 # in reality, might want to use a separate transaction for this.
62
63 with db1.begin() as c:
64 nextid = c.execute(ids.select().with_for_update()).scalar()
65 c.execute(
66 ids.update().values({ids.c.nextid: ids.c.nextid + 1})
67 )
68 return nextid
69
70 cls.tables.weather_locations = weather_locations = Table(
71 "weather_locations",

Callers

nothing calls this directly

Calls 7

beginMethod · 0.45
scalarMethod · 0.45
executeMethod · 0.45
with_for_updateMethod · 0.45
selectMethod · 0.45
valuesMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected