← Back to team overview

launchpad-dev team mailing list archive

Re: Get the query generated by Storm

 

Hi Gary,

On Thu, Mar 3, 2011 at 3:54 AM, Gary Poster <gary.poster@xxxxxxxxxxxxx> wrote:
> 1) Let's say you want to see what SQL is being generated by Storm in
> a test.  Is there a better way to do it other than debugger breaks
> into Storm guts?

There's a builtin debug tracer you can use for cases like this.
Sometimes I take a test like this:

    def test_some_storm_code(self):
        < some setup logic >
        < the Storm-using code I'm curious about >
        < more stuff >

And I use the debug tracer to see what's going on:

    def test_some_storm_code(self):
        < some setup logic >
        from storm.tracer import debug; debug(True)
        try:
            < the Storm-using code I'm curious about >
        finally:
            debug(False)
        < more stuff >

We should probably provide a context manager so that you can use
'with', since it'd involve a touch less typing, but this is handy
nonetheless.

Thanks,
J.



Follow ups

References