Các khái niệm về Databricks
Kevin Barlow
Data Practitioner

Spark là framework linh hoạt, đọc được nhiều nguồn/kiểu dữ liệu.
Nguồn và kiểu phổ biến:



Spark là framework linh hoạt, đọc được nhiều nguồn/kiểu dữ liệu.
Nguồn và kiểu phổ biến:
#Delta table
spark.read.table()
#CSV files
spark.read.format('csv').load('*.csv')
#Postgres table
spark.read.format("jdbc")
.option("driver", driver)
.option("url", url)
.option("dbtable", table)
.option("user", user)
.option("password", password)
.load()
Bảng Delta mang lại tính năng như bảng cho định dạng tệp mở.



DataFrame là biểu diễn dữ liệu hai chiều.
| id | customerName | bookTitle |
|---|---|---|
| 1 | John Data | Guide to Spark |
| 2 | Sally Bricks | SQL for Data Engineering |
| 3 | Adam Delta | Keeping Data Clean |
df = (spark.read
.format("csv")
.option("header", "true")
.option("inferSchema", "true")
.load("/data.csv"))
Các loại bảng trong Databricks
df.write.saveAsTable(table_name)
CREATE TABLE table_name
USING delta
AS ...
df.write
.location('').saveAsTable(table_name)
CREATE TABLE table_name
USING delta
LOCATION "<path>"
AS ...
Các khái niệm về Databricks