1. Databricks SQL queries and dashboards
Hey there! In this video, we will dive deeper into Databricks SQL and show some of the different ways you can enhance your querying experience.
2. Databricks SQL Assets
So far, we have explored the basics of a query in Databricks SQL. The query is the foundation of everything in Databricks SQL and will provide many insights into what you want to understand. The query is not all there is, however, and other kinds of assets are part of Databricks SQL.
3. Databricks SQL Assets
Within each query, the user can create a number of visualizations!
4. Visualizations
In the Databricks SQL context, visualizations are lightweight graphical representations of your query results. These are a great option for your analyses since they are built into the platform you are already using!
Databricks SQL will support the most general and common visualization types, ranging from line or scatter plots to more complex visuals like geospatial or Sankey plots. Regardless of what kind of visualization you pick, these provide a great way to further understand your data graphically.
This screenshot shows the UI to create a standard bar chart based on a given dataset.
5. Databricks SQL Assets
Now we have understood that a query can have one or more visualizations tied to it. Imagine we have been working in Databricks SQL for a while and have created a few different queries, each with its own visualizations. While each of these on their own will provide us with good insight, wouldn't it be nice to view all of these results in one location?
6. Databricks SQL Assets
This is where the Databricks SQL dashboard will come into play!
7. Dashboards
Dashboards in Databricks SQL provide a quick, lightweight, and simple tool to view multiple queries, visualizations, and text all in one location. Typically, these dashboards are used for internal reporting regarding the state of your data in your organization. Since queries, visualizations, and dashboards are all within the Databricks platform, they can be easily shared and governed with Unity Catalog, just like your datasets! Since these will use SQL Warehouses under the hood to refresh data, these dashboards are very scalable and performant.
8. Query Filters
For all your queries, visualizations, and dashboards, Databricks SQL provides several methods to make the end-user experience more interactive.
Filters are one such component and provide a quick way for the end user to limit the size and scope of the result dataset they view. These are very simple to create and are managed on the client side, meaning they run quickly. Filters support various kinds of select operations and accept text or datetime inputs. From a SQL perspective, we can think of Filters as adding a WHERE clause to the underlying query, but the end user does not have to know how to write that. In this code example, we added two different filters for the pickup and dropoff zip codes. In the back-end, we have essentially created the two WHERE clauses at the end of the query, but the user did not know how to type them.
9. Query Parameters
Parameters are a similar component to filters but are a much more flexible component. Parameters, unlike filters, allow the user to provide input directly into the underlying SQL query. These can be created by using double curly brackets in the SQL query, and a widget is surfaced to the query user. In this following code example, you can see our previous query now has a new parameter for a Null Check field. Since parameters are flexible, we can insert the parameter anywhere in the query. In this case, we extended the previous query by allowing the user to define which column should not have a null value, and that will pass into the query plan.
10. Let's practice!
Let us revisit our Databricks SQL queries and see how to practice using these other capabilities!