Thursday 16 June 2022

Hive: Execute sql statements from a file

Syntax

hive -f {sql_file_path}

 

Example

hive -f test.sql

 

test.sql

SHOW tables;

$hive -f test.sql 
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/Cellar/hive/3.1.2_2/libexec/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/Cellar/hadoop/3.3.0/libexec/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Hive Session ID = 40c654f2-7a3f-44dd-bf99-f94d08846c0e

Logging initialized using configuration in jar:file:/usr/local/Cellar/hive/3.1.2_2/libexec/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true
Hive Session ID = 708b99bd-c28a-4f65-9237-32c86e7d3bea
OK
Time taken: 1.107 seconds

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment