You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apache-bigdata/3.flask-hadoop-hive/app.py
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,26 @@
4
4
frompyhiveimporthive
5
5
6
6
cursor=hive.connect('localhost').cursor()
7
-
cursor.execute("CREATE TABLE IF NOT EXISTS employee ( eid int, name String, salary String, destignation String) COMMENT 'employee details' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE")
8
-
cursor.execute("LOAD DATA LOCAL INPATH 'sample.txt' OVERWRITE INTO TABLE employee")
7
+
cursor.execute(
8
+
"CREATE TABLE IF NOT EXISTS employee ( eid int, name String, salary String, destignation String) COMMENT 'employee details' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE"
9
+
)
10
+
cursor.execute(
11
+
"LOAD DATA LOCAL INPATH 'sample.txt' OVERWRITE INTO TABLE employee"
12
+
)
9
13
10
14
app=Flask(__name__)
11
15
16
+
12
17
@app.route('/')
13
18
defhello_world():
14
19
return'Hey, we have Flask in a Docker container!'
15
20
21
+
16
22
@app.route('/employee/<string:person>/')
17
23
defget(person):
18
-
cursor.execute("SELECT * FROM employee WHERE name = '%s'"%(person))
24
+
cursor.execute("SELECT * FROM employee WHERE name = '%s'"%(person))
0 commit comments