This get started article walks you through using an Azure Databricks notebook to query sample data stored in Unity Catalog using SQL, Python, Scala, and R and then visualize the query results in the notebook.
RequirementsTo complete the tasks in this article, you must meet the following requirements:
To create a notebook in your workspace, click New in the sidebar, and then click Notebook. A blank notebook opens in the workspace.
To learn more about creating and managing notebooks, see Manage notebooks.
Step 2: Query a tableQuery the samples.nyctaxi.trips
table in Unity Catalog using the language of your choice.
Copy and paste the following code into the new empty notebook cell. This code displays the results from querying the samples.nyctaxi.trips
table in Unity Catalog.
SELECT * FROM samples.nyctaxi.trips
Python
display(spark.read.table("samples.nyctaxi.trips"))
Scala
display(spark.read.table("samples.nyctaxi.trips"))
R
library(SparkR)
display(sql("SELECT * FROM samples.nyctaxi.trips"))
Press Shift+Enter
to run the cell and then move to the next cell.
The query results appear in the notebook.
Display the average fare amount by trip distance, grouped by the pickup zip code.
Next to the Table tab, click + and then click Visualization.
The visualization editor displays.
In the Visualization Type drop-down, verify that Bar is selected.
Select fare_amount
for the X column.
Select trip_distance
for the Y column.
Select Average
as the aggregation type.
Select pickup_zip
as the Group by column.
Click Save.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4