The Query Behind the Viz

Several posts here have explored the queries Tableau generates as it builds your viz, including last week’s write-up on custom SQL. This is a trend that will continue: it’s much easier to understand a machine when you can see its inner workings.

But how do I get at those queries? I was talking with Yvan Fornes, and he suggested that I write about how I do it.

Challenge accepted! Except I may have gone overboard: in this post I’ll explore three ways to find the queries underlying your viz.

Continue reading

Row-Level Security: A Cautionary Tale

Row-level security is a common requirement for people trying to control access to data. Some systems provide this natively, but when it’s not provided, people often roll their own using the tools they have—with mixed results

In this post we’ll explore a common way to implement row-level security on top of a relational database and see why it may not be as secure as it looks.

A Pop Quiz

But before we get to the crux of the issue, here’s a quick quiz. I promise it’s relevant.

What will each of the following languages do when a is equal to 0​?

  1. C, C++, C#, Java, and most other C-family languages:
    if (a != 0 && 1/a > 0) { /* Do something */ }
  2. Pascal:
    IF a <> 0 AND 1/a > 0 THEN (* Do something *)
  3. SQL:
    SELECT *
    FROM T
    WHERE a <> 0 AND 1/a > 0

Obviously, I’m asking about short circuiting behavior. I’ll let you ponder and reveal the answers in a moment. But first, back to row-level security.

Continue reading