Event Tables in Snowflake
1. Event Tables in Snowflake
Event tables are the core foundational object in Snowflake that you can use to store telemetry about your pipelines. They're mostly like your common table object in Snowflake, but they're a little special in the sense that they're specifically designed for capturing telemetry. Event tables are where you'll store logs and traces from code in your Snowflake environment. Snowflake provides a default event table in all Snowflake accounts, but you can also create your own event tables. When you create an event table, you'll notice that it's created with a default set of columns. These columns follow the data model set by the open telemetry standards. This adherence to an open standard makes it easy to implement observability with familiarity and quickly derive insights from your logs and traces in Snowflake. Let me show you how easy it is to set up and use event tables. Now is a good time to pause the video and log into your Snowflake account. Start by opening a new SQL worksheet. Set your role to account admin. Snowflake's default event table lives inside the snowflake.telemetry schema. Let's query it so that we can view its columns. Type use database snowflake, use schema telemetry, select star from events. Run this code. Of course there's nothing in this table because we haven't captured any telemetry, but from this query you can see the columns that the table uses. Let's take a better look. Type describe table events. This will give you a better sense of what the columns are intended to capture. If you scroll to the right, you'll see there's a comment describing each column. As you can see, some of these columns are reserved for future use. Some of the columns are related to the timestamps in UTC, which represent the event occurrence timestamp. Some columns are for tracing and more. And again, Snowflake sets up this event table for you by default. Okay, but rather than use the default event table, let's create our own event table that we can use to capture telemetry. In the worksheet, type use database staging tastybytes. Create or replace schema telemetry. Create or replace event table pipeline events. Run these few lines of code. You should see a success message, and if you describe this new table, you'll see that we have the same standard telemetry columns in it. Type describe table pipeline events. Let's now run alter account set event table equals staging tastybytes dot telemetry dot pipeline events. This will set our newly created event table as our preferred event table in our account. That's it. In just a few lines of code, you create the default event table and you created your own event table. We're going to use the pipeline events event table to capture telemetry for our Hamburg weather pipeline. We're not going to do this in a declarative fashion or introduce these changes using the DevOps practices that we covered in the previous module. This is so that you can focus on the core concepts and mechanics of observability without getting distracted by how to introduce these new changes with DevOps, which, by the way, you already learned how to do in the last module. Okay, join me in the next video to learn about how to capture logs into event tables.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.