analyst-collective / analytics

Open source data models and analysis.
Apache License 2.0
46 stars 11 forks source link

Event stream funnels #6

Closed drewbanin closed 8 years ago

drewbanin commented 8 years ago

@jthandy tried implementing funnels two different ways. This isn't fully baked, but super keen to get some early feedback

jthandy commented 8 years ago

I just ran these analyses. They worked, which is really cool in and of itself. I was actually a little surprised that they just worked, and I think that feeling will be shared with others when they run them for the first time.

Here's my challenge though. Currently, I had to really read through them to figure out how to do some customization. And SQL is never that readable; you really have to parse through it to figure out what's going on. In one instance I had to change a date range to get results, in another I had to change funnel stages.

This is not impossible to do by any means. But I wonder if we could potentially use CTEs to act as configuration for the query. So, for example, there could be an initial CTE that was just called "config", and it just contained name/value pairs of config options that then got supplied later in the query.

I'm not suggesting that this is some ideal solution, and even if we didn't do anything with this in this PR I would be fine with that, I just wanted to share my initial experience of consuming someone else's query sight unseen. The only other suggestion that I have is that we should really pay a lot of attention to readability. Extra line spacing, more inline comments, and more comments at the top specifying how the analyst should actually use this query would all be helpful as well.

drewbanin commented 8 years ago

@jthandy that config CTE is a really interesting idea. I tried to logically group these things into CTEs which should and should not be modified.... Agree that it needs a little more work

jthandy commented 8 years ago

My only worry about the config CTE is that it would create more ugliness than it solves. I just wish there were fucking variables in SQL. If one day we create another language which compiles to SQL, one of the first things I want is fucking variables.

drewbanin commented 8 years ago

@jthandy merging