-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHive_Operator.py
More file actions
31 lines (27 loc) · 782 Bytes
/
Hive_Operator.py
File metadata and controls
31 lines (27 loc) · 782 Bytes
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
from airflow.operators.hive_operator import HiveOperator
creating_forex_rates_table = HiveOperator(
task_id="creating_forex_rates_table",
hive_cli_conn_id="hive_conn",
hql="""
CREATE EXTERNAL TABLE IF NOT EXISTS forex_rates(
base STRING,
last_update DATE,
eur DOUBLE,
usd DOUBLE,
nzd DOUBLE,
gbp DOUBLE,
jpy DOUBLE,
cad DOUBLE
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
"""
)
# connection config:
conn_id: hive_conn
conn_type: Hive Server 2 Thrift
Host: hive-server
Login: hive
Password: hive
Port 10000