This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
I’m testing a script against a live database. Accessing the db is slow and the test iterates trough all rows each time. Since I’m gradually increasing rows on each test run, I need only some, but not all rows. Problem: How can I avoid loading all rows but only fetch some ? Solution : Use yield Takeaway: Memorize the word yield as alias for fetch some. Why words matter is beautifully…
I’m testing a script against a live database.
Accessing the db is slow and the test iterates trough all rows each time.
Since I’m gradually increasing rows on each test run, I need only some, but not all rows.
Problem: How can I avoid loading all rows but only fetch some?
Solution: Use yield
Takeaway: Memorize the word yield as alias for fetch some.
Why words matter is beautifully reasoned by Raymond Hettinger in this youtube video.
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.