[Hive - LanguageManual] Create/Drop/Grant/Revoke Roles and Privileges / Show Use
Create/Drop/Grant/Revoke Roles and Privileges
Hive Default Authorization - Legacy Mode has information about these DDL statements:
- CREATE ROLE
- GRANT ROLE
- REVOKE ROLE
- GRANT privilege_type
- REVOKE privilege_type
- DROP ROLE
- SHOW ROLE GRANT
- SHOW GRANT
For SQL standard based authorizationin Hive 0.13.0 and later releases, see these DDL statements:
- Role Management Commands
- Object Privilege Commands
Show
These statements provide a way to query the Hive metastore for existing data and metadata accessible to this Hive system.
Show Databases
SHOW (DATABASES|SCHEMAS) [LIKE identifier_with_wildcards]; |
SHOW DATABASES or SHOW SCHEMAS lists all of the databases defined in the metastore. The uses of SCHEMAS and DATABASES are interchangeable – they mean the same thing.
The optional LIKE clause allows the list of databases to be filtered using a regular expression. Wildcards in the regular expression can only be '*' for any character(s) or '|' for a choice. Examples are 'employees', 'emp*', 'emp*|*ees', all of which will match the database named 'employees'.
Show Tables/Partitions/Indexes
Show Tables
SHOW TABLES [IN database_name] [identifier_with_wildcards]; |
SHOW TABLES
lists all the base tables and views in the current database (or the one explicitly named using the IN
clause) with names matching the optional regular expression. Wildcards in the regular expression can only be '*' for any character(s) or '|' for a choice. Examples are 'page_view', 'page_v*', '*view|page*', all which will match the 'page_view' table. Matching tables are listed in alphabetical order. It is not an error if there are no matching tables found in metastore. If no regular expression is given then all tables in the selected database are listed.
Show Partitions
SHOW PARTITIONS table_name; |
SHOW PARTITIONS lists all the existing partitions for a given base table. Partitions are listed in alphabetical order.
Version information
Icon
As of Hive 0.6, SHOW PARTITIONS can filter the list of partitions as shown below.
It is also possible to specify parts of a partition specification to filter the resulting list. For example:
SHOW PARTITIONS table_name PARTITION(ds= '2010-03-03' ); -- (Note: Hive 0.6 and later) SHOW PARTITIONS table_name PARTITION(hr= '12' ); -- (Note: Hive 0.6 and later) SHOW PARTITIONS table_name PARTITION(ds= '2010-03-03' , hr= '12' ); -- (Note: Hive 0.6 and later) |
Version information
Icon
Starting with Hive 0.13.0, SHOW PARTITIONS can specify a database (HIVE-5912).
SHOW PARTITIONS [db_name.]table_name [PARTITION(partition_spec)]; -- (Note: Hive 0.13 . 0 and later) |
Example:
SHOW PARTITIONS databaseFoo.tableBar PARTITION(ds= '2010-03-03' , hr= '12' ); -- (Note: Hive 0.13 . 0 and later) |
Show Table/Partition Extended
SHOW TABLE EXTENDED [IN|FROM database_name] LIKE identifier_with_wildcards [PARTITION(partition_spec)]; |
SHOW TABLE EXTENDED will list information for all tables matching the given regular expression. Users cannot use regular expression for table name if a partition specification is present. This command's output includes basic table information and file system information like totalNumberFiles, totalFileSize, maxFileSize, minFileSize,lastAccessTime, and lastUpdateTime. If partition is present, it will output the given partition's file system information instead of table's file system information.
Show Table Properties
Version information
Icon
As of Hive 0.10.0.
SHOW TBLPROPERTIES tblname; SHOW TBLPROPERTIES tblname( "foo" ); |
The first form lists all of the table properties for the table in question one per row separated by tabs. The second form of the command prints only the value for the property that's being asked for.
Show Create Table
SHOW CREATE TABLE ([db_name.]table_name|view_name); |
SHOW CREATE TABLE shows the CREATE TABLE statement that creates a given table, or the CREATE VIEW statement that creates a given view.
Show Indexes
Version information
Icon
As of Hive 0.7.
SHOW [FORMATTED] (INDEX|INDEXES) ON table_with_index [(FROM|IN) db_name]; |
SHOW INDEXES shows all of the indexes on a certain column, as well as information about them: index name, table name, names of the columns used as keys, index table name, index type, and comment. If the FORMATTED keyword is used, then column titles are printed for each column.
Show Columns
SHOW COLUMNS (FROM|IN) table_name [(FROM|IN) db_name]; |
SHOW COLUMNS shows all the columns in a table including partition columns.
Show Functions
SHOW FUNCTIONS "a.*" ; |
SHOW FUNCTIONS lists all the user defined and builtin functions matching the regular expression. To get all functions use ".*"
Show Granted Roles and Privileges
Hive Default Authorization - Legacy Mode has information about these SHOW statements:
In Hive 0.13.0 and later releases, SQL standard based authorization has these SHOW statements:
Show Locks
SHOW LOCKS <table_name>; SHOW LOCKS <table_name> EXTENDED; SHOW LOCKS <table_name> PARTITION (<partition_spec>); SHOW LOCKS <table_name> PARTITION (<partition_spec>) EXTENDED; SHOW LOCKS (DATABASE|SCHEMA) database_name; -- (Note: Hive 0.13.0 and later; SCHEMA added in Hive 0.14.0) |
SHOW LOCKS displays the locks on a table or partition. See Hive Concurrency Model for information about locks.
SHOW LOCKS (DATABASE|SCHEMA) is supported from Hive 0.13 for DATABASE (see HIVE-2093) and Hive 0.14 for SCHEMA (see HIVE-6601). SCHEMA and DATABASE are interchangeable – they mean the same thing.
When Hive transactions are being used, SHOW LOCKS returns this information (see HIVE-6460):
- database name
- table name
- partition name (if the table is partitioned)
- the state the lock is in, which can be:
- "acquired" – the requestor holds the lock
- "waiting" – the requestor is waiting for the lock
- "aborted" – the lock has timed out but has not yet been cleaned up
- the type of lock, which can be:
- "exclusive" – no one else can hold the lock at the same time (obtained mostly by DDL operations such as drop table)
- "shared_read" – any number of other shared_read locks can lock the same resource at the same time (obtained by reads; confusingly, an insert operation also obtains a shared_read lock)
- "shared_write" – any number of shared_read locks can lock the same resource at the same time, but no other shared_write locks are allowed (obtained by update and delete)
- ID of the transaction this lock is associated with, if there is one
- last time the holder of this lock sent a heartbeat indicating it was still alive
- the time the lock was acquired, if it has been acquired
- Hive user who requested the lock
- host the user is running on
Show Conf
SHOW CONF <configuration_name>; |
SHOW CONF returns a description of the specified configuration property.
- default value
- required type
- description
Note that SHOW CONF does not show the current value of a configuration property. For current property settings, use the "set" command in the CLI or a HiveQL script (see Commands) or in Beeline (see Beeline Hive Commands).
Show Transactions
SHOW TRANSACTIONS; |
SHOW TRANSACTIONS is for use by administrators when Hive transactions are being used. It returns a list of all currently open and aborted transactions in the system, including this information:
- transaction ID
- transaction state
- user who started the transaction
- machine where the transaction was started
Show Compactions
SHOW COMPACTIONS; |
SHOW COMPACTIONS returns a list of all tables and partitions currently being compacted or scheduled for compaction when Hive transactions are being used, including this information:
- database name
- table name
- partition name (if the table is partitioned)
- whether it is a major or minor compaction
- the state the compaction is in, which can be:
- "initiated" – waiting in the queue to be compacted
- "working" – being compacted
- "ready for cleaning" – the compaction has been done and the old files are scheduled to be cleaned
- thread ID of the worker thread doing the compaction (only if in working state)
- the time at which the compaction started (only if in working or ready for cleaning state)
Compactions are initiated automatically, but can also be initiated manually with an ALTER TABLE COMPACT statement.
[Hive - LanguageManual] Create/Drop/Grant/Revoke Roles and Privileges / Show Use的更多相关文章
- [Hive - LanguageManual] Create/Drop/Alter Database Create/Drop/Truncate Table
Hive Data Definition Language Hive Data Definition Language Overview Create/Drop/Alter Database Crea ...
- [Hive - LanguageManual] Create/Drop/Alter -View、 Index 、 Function
Create/Drop/Alter View Create View Drop View Alter View Properties Alter View As Select Version info ...
- [Hive - LanguageManual] Hive Default Authorization - Legacy Mode
Disclaimer Prerequisites Users, Groups, and Roles Names of Users and Roles Creating/Dropping/Using R ...
- postgreSQL 之 Privilege & grant & revoke(未完待续)
When an object is created, it is assigned an owner. The owner is normally the role that executed the ...
- [Hive - LanguageManual ] ]SQL Standard Based Hive Authorization
Status of Hive Authorization before Hive 0.13 SQL Standards Based Hive Authorization (New in Hive 0. ...
- create和grant配合使用,对Mysql进行创建用户和对用户授权
1.首先创建用户username以及密码passwd,授权主机localhost. create user ‘username’@'localhost' identified by 'passwd' ...
- 【转】MySQL GRANT REVOKE用法
MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器 授权->确定用户是否拥有足够的权限执行查询请求等. 如果认证不成功的话,哪么授权肯定是无法进行的. revo ...
- mysql进阶(二十八)MySQL GRANT REVOKE用法
mysql进阶(二十八)MySQL GRANT REVOKE用法 MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器: 授权->确定用户是否拥有足够的权限执 ...
- MYSQL用户权限管理(Grant,Revoke)
MySQL可以为不同的用户分配严格的.复杂的权限.这些操作大多都可以用SQL指令Grant(分配权限)和Revoke(回收权限)来实现. Grant可以把指定的权限分配给特定的用户,如果这个用户不存在 ...
随机推荐
- PowerDesigner中转换物理模型时的命名转换
原文:PowerDesigner中转换物理模型时的命名转换 最近在使用PowerDesigner建模数据库,在使用中积累了一些遇到的问题和解决办法,记录下来,希望对遇到同样问题的朋友有所帮助. 早 期 ...
- Retrofit所有知识场景汇总
https://futurestud.io/blog/retrofit-getting-started-and-android-client Retrofit Series Overview Gett ...
- 删除单链表的倒数第k个结点
策略 直接遍历总数为len,再次遍历第len-k+1个就是答案,但是这样遍历了O(N+k)个,可以在O在更短的时间内找到 图示 参考代码 #include <iostream> using ...
- MapReduce编程系列 — 6:多表关联
1.项目名称: 2.程序代码: 版本一(详细版): package com.mtjoin; import java.io.IOException; import java.util.Iterator; ...
- 写Java程序让Jvm崩溃
package jvm; public class HeapCrash { public static void main(String[] args) { //Object[] o = {“abc” ...
- 23.allegro中自动布线[原创]
1. --- 方法①:选择网络自动布线 -- --- 已经步好: --- 方法②: ---- ---- 布线: --- 方法③: -- ----
- 启动PL/SQL Developer 报字符编码不一致错误 Database character set (AL32UTF8) and Client character set (ZHS16GBK) are different. Character set conversion may cause unexpected results. Note: you can set the client
今天写hibernate时候遇到一些异常 代码: 出现异常情况: 出现以上原因是Session关闭 如果不是使用的SessionFactory.getSession()来获得Session. 而是使用 ...
- JS兼容性问题(FF与IE)
不同浏览器中js兼容问题大全 1.document.formName.item('itemName')问题 说明: //IE下(两种) document.formName.item("ite ...
- asp.net获取文件夹下的所有文件
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System. ...
- hdu 4635 Strongly connected(强连通)
考强连通缩点,算模板题吧,比赛的时候又想多了,大概是不自信吧,才开始认真搞图论,把题目想复杂了. 题意就是给你任意图,保证是simple directed graph,问最多加多少条边能使图仍然是si ...