Desperately Seeking Connections by Joining with Snowflake

Today, I want to talk about that fun edge case when you’re having to join a table to itself in Snowflake. Does it happen often? Not unless your architect just hates you. Let’s use the normal pieces of data that everyone uses for this kind of thing – employee/manager relationships. We have our employee table…… Continue reading Desperately Seeking Connections by Joining with Snowflake

Laterally a new move

In Snowflake, you can do something akin to an APPLY, but not. That, my friends, is a LATERAL join. According to Snowflake documentation, this type of join “allows an inline view to reference columns from the table expression that precedes the inline view.” Yes, that’s gibberish. Let’s show what you’re doing. To test this out,…… Continue reading Laterally a new move

Flattening out data in SnowFlake

Sometimes you have to work with different kinds of data in Snowflake – just like in most databases. Today I want to work with some JSON – the same basic premise works for XML, Arrays, and other variants. SELECT * FROM TABLE(FLATTEN(input => parse_json(‘[3089, NULL, 217]’))); So, first, let’s go thru the parse_json portion. Notice…… Continue reading Flattening out data in SnowFlake