-
Notifications
You must be signed in to change notification settings - Fork 538
/
Copy path03-spark-table-demo.sql
71 lines (52 loc) · 1.52 KB
/
03-spark-table-demo.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-- Databricks notebook source
drop table if exists demo_db.fire_service_calls_tbl;
drop view if exists demo_db;
-- COMMAND ----------
-- MAGIC %fs rm -r /user/hive/warehouse/demo_db.db
-- COMMAND ----------
create database if not exists demo_db
-- COMMAND ----------
create table if not exists demo_db.fire_service_calls_tbl(
CallNumber integer,
UnitID string,
IncidentNumber integer,
CallType string,
CallDate string,
WatchDate string,
CallFinalDisposition string,
AvailableDtTm string,
Address string,
City string,
Zipcode integer,
Battalion string,
StationArea string,
Box string,
OriginalPriority string,
Priority string,
FinalPriority integer,
ALSUnit boolean,
CallTypeGroup string,
NumAlarms integer,
UnitType string,
UnitSequenceInCallDispatch integer,
FirePreventionDistrict string,
SupervisorDistrict string,
Neighborhood string,
Location string,
RowID string,
Delay float
) using parquet
-- COMMAND ----------
insert into demo_db.fire_service_calls_tbl
values(1234, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null)
-- COMMAND ----------
select * from demo_db.fire_service_calls_tbl
-- COMMAND ----------
truncate table demo_db.fire_service_calls_tbl
-- COMMAND ----------
insert into demo_db.fire_service_calls_tbl
select * from global_temp.fire_service_calls_view
-- COMMAND ----------
select * from demo_db.fire_service_calls_tbl
-- COMMAND ----------