Merge lp://staging/~abentley/storm/executemany into lp://staging/storm
Status: | Rejected |
---|---|
Rejected by: | Kevin McDermott |
Proposed branch: | lp://staging/~abentley/storm/executemany |
Merge into: | lp://staging/storm |
Diff against target: |
875 lines (+442/-81) 8 files modified
storm/database.py (+39/-6) storm/store.py (+7/-0) storm/tracer.py (+50/-7) tests/database.py (+109/-4) tests/databases/postgres.py (+14/-0) tests/mocker.py (+2/-2) tests/store/base.py (+20/-0) tests/tracer.py (+201/-62) |
To merge this branch: | bzr merge lp://staging/~abentley/storm/executemany |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Aaron Bentley (community) | Disapprove | ||
Stuart Bishop (community) | Approve | ||
Storm Developers | Pending | ||
Review via email: mp+93653@code.staging.launchpad.net |
Commit message
Support cursor.executemany all through the stack.
Description of the change
This branch adds support for cursor.executemany to Storm.
My use case is the Launchpad's branch scanner, and even compared to a single execute using multiple escaped rows, executemany completes in 1/3 the time.
I've done my best to make sure executemany is tested just as rigourously as execute, but please let me know if there are any ways you'd like the tests done differently.
test_capture_
if action.kind was "getattr", Patcher.execute would raise an AttributeError referring to the wrong variable, so I changed the bare raise to "raise e".
Unmerged revisions
- 440. By Aaron Bentley
-
Cleanup.
- 439. By Aaron Bentley
-
Test executemany unicode handling on Postgres.
- 438. By Aaron Bentley
-
Add and test Store.executemany
- 437. By Aaron Bentley
-
executeall -> executemany
- 436. By Aaron Bentley
-
Test parameter conversion with executeall.
- 435. By Aaron Bentley
-
Remove duplicate test.
- 434. By Aaron Bentley
-
Test tracing executeall.
- 433. By Aaron Bentley
-
Update all tracer tests for executeall.
- 432. By Aaron Bentley
-
Add raw_executeall support to DebugTracer.
> This branch adds support for cursor.executemany to Storm.
>
> My use case is the Launchpad's branch scanner, and even compared to a single execute using multiple escaped rows, executemany completes in 1/3 the time.
There is another branch going through review that implements
multivalued INSERT. For this use case, I'm not sure which will end up
faster. Still, this branch has other uses such as multiple UPDATEs,
and possibly multiple SELECTs where a stored procedure is being
invoked (possibly this will fail, as each SELECT will return a result
set and the DB-API lets the driver fail in this case).
I'm fine with this. I found one typo, and have a few comments that
don't require any changes.
> + def _raw_execute(self, statement, params, executemany):
Did you try having this split into _raw_execute and _raw_execute_many?
I suspect it will be better despite some code duplication. Similarly
for _execute. I'm fine with this design though if you feel this is the
more maintainable variant.
> + def connection_ raw_executemany _error( self, connection, raw_cursor, rror("% s.connection_ raw_execute_ error() must be " class__ .__name_ _)
> + statement, params, error):
> + """Raise TimeoutError if the given error was a timeout issue.
> +
> + Must be specialized in the backend.
> + """
> + raise NotImplementedE
> + "implemented" % self.__
Typo here in the error message - execute__error instead of executemany_error.
> def test_execute_ convert_ param_style( self): .execute( "'?' ? '?' ? '?'") ls(self. executed, [("'?' ? '?' ? '?'", marker)])
> - self.connection
> - self.assertEqua
Should this be removed, or was this a valid test with an invalid name?
> + def test_unicode_ many(self) : xc3\xa9\ xc3\xad\ xc3\xb3\ xc3\xba" decode( "UTF-8" )
> + raw_str = "\xc3\xa1\
> + uni_str = raw_str.
I see you are cribbing from existing tests so this is fine. I always
prefer to use u'\N{TRADE MARK SIGN}' style notation to construct valid
Unicode strings without polluting ASCII source files.
> + def prepare_ raise_timeout_ on_granularity( self): patch(self. tracer) mock.get_ remaining_ time() result( self.tracer. granularity) mock.set_ statement_ timeout( self.raw_ cursor, granularity) mock.get_ remaining_ time() result( 0) replay( ) timeout_ on_granularity( self):
> + tracer_mock = self.mocker.
> +
> + self.mocker.order()
> +
> + tracer_
> + self.mocker.
> + tracer_
> + self.tracer.
> + tracer_
> + self.mocker.
> + self.mocker.
> +
> def test_raise_
Instead of these prepare + 2 * execute tests, it might have been
better to subclass the TestCase and override the self.execute method
to do executemany.
--
Stuart Bishop <email address hidden>