MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_get_explicit_shard

Method test_get_explicit_shard

test/ext/test_horizontal_shard.py:246–266  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

244 sess.get_one(WeatherLocation, 25)
245
246 def test_get_explicit_shard(self):
247 sess = self._fixture_data()
248 tokyo = (
249 sess.query(WeatherLocation)
250 .set_shard("europe")
251 .where(WeatherLocation.id == 1)
252 .first()
253 )
254 is_(tokyo, None)
255
256 newyork = (
257 sess.query(WeatherLocation)
258 .set_shard("north_america")
259 .where(WeatherLocation.id == 2)
260 .first()
261 )
262 eq_(newyork.city, "New York")
263
264 # now it found it
265 t2 = sess.get(WeatherLocation, 1)
266 eq_(t2.city, "Tokyo")
267
268 @testing.variation("option_type", ["none", "lazyload", "selectinload"])
269 @testing.variation(

Callers

nothing calls this directly

Calls 8

_fixture_dataMethod · 0.95
is_Function · 0.90
eq_Function · 0.90
set_shardMethod · 0.80
firstMethod · 0.45
whereMethod · 0.45
queryMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected