Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

beeline show tables?

avatar
Expert Contributor

1)what is the difference between these two commands?

To get table names in a database which one i need to use?

0: jdbc:hive2://> show tables; or

0: jdbc:hive2://> !tables

2)How to run HDFS ,Unix commands in beeline?

4 REPLIES 4

avatar
Expert Contributor
@vamsi valiveti

1) 'show tables;' is the standard SQL way of getting table names. '!tables' is specific to Beeline so use 'show tables;' to make sure your SQL is portable to other SQL clients.

2) Use '!sh <command>' to run shell command, e.g.

0: jdbc:hive2://hdp224.local:10000/default> !sh hdfs dfs -ls /
Found 9 items
drwxrwxrwx   - yarn   hadoop          0 2016-11-01 14:07 /app-logs
drwxr-xr-x   - hdfs   hdfs            0 2016-11-01 12:41 /apps
drwxr-xr-x   - yarn   hadoop          0 2016-11-01 15:55 /ats
drwxr-xr-x   - usera  users           0 2016-11-01 14:29 /data
drwxr-xr-x   - hdfs   hdfs            0 2016-11-01 12:38 /hdp
drwxr-xr-x   - mapred hdfs            0 2016-11-01 12:38 /mapred
drwxrwxrwx   - mapred hadoop          0 2016-11-01 12:38 /mr-history
drwxrwxrwx   - hdfs   hdfs            0 2016-11-01 15:56 /tmp
drwxr-xr-x   - hdfs   hdfs            0 2016-11-01 14:06 /user

avatar
Expert Contributor

Thanks for quick response.

0: jdbc:hive2://hdp224.local:10000/default> !sh hdfs dfs -ls / is to run the HDFS commands

How to run Linux shell commands from beeline i mean how we will run below command in beeline

hive>!pwd;

avatar
Expert Contributor

Any Input on my clarifications.

avatar
New Contributor

'Hiển thị bảng;' is how to SQL tiêu chuẩn receive bảng tên. '! Bảng "is cụ thể cho Beeline to use 'bảng hiển thị;' to ensure SQL of you is xách tay cho all khách hàng khác SQL.

2) Use '! Sh <script> 'to run shell commands, for example like

  1. 0: jdbc: hive2: //hdp224.local:10000/default> sh HDFS dfs -ls /!
  2. Tìm thấy 9 mặt hàng
  3. drwxrwxrwx - sợi hadoop 0 năm 2016-11 - 01 14: 07 / ứng dụng - bản ghi
  4. drwxr - xr - x - HDFS HDFS 0 năm 2016-11 - 01 12: 41 / application
  5. drwxr - xr - x - sợi hadoop 0 năm 2016-11 - 01 15: 55 / ATS
  6. drwxr - xr - x - UserA người sử dụng 0 năm 2016-11 - 01 14: 29 / dữ liệu
  7. drwxr - xr - x - HDFS HDFS 0 năm 2016-11 - 01 12: 38 / HDP
  8. drwxr - xr - x - HDFS mapred 0 năm 2016-11 - 01 12: 38 / mapred
  9. drwxrwxrwx - mapred hadoop 0 năm 2016-11 - 01 12: 38 / mr - lịch sử
  10. drwxrwxrwx - HDFS HDFS 0 năm 2016-11 - 01 15: 56 / tmp
  11. drwxr - xr - x - HDFS HDFS 0 năm 2016-11 - 01 14: 06 / user ' Cảm ơn, may mắn thay tôi cũng muốn biết