hive_query()

Read(338) Label: query, hive database,

Description:

Query a Hive database and return the result as a sequence.

Syntax:

hive_query(con,sql)

Note:

This external library function executes a certain SQL query on a Hive database, and returns the query result as a table sequence. The parameter con represents database connection.

Parameters:

con

Database connection string.

sql

A SQL query statement, like select * from table.

Return value:

Table sequence

Example:

 

A

 

1

=hive_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","hive","asus")

Connect to the hive database

2

=hive_query(A1, "select  *  from  table")

Query data in table

3

=hive_close()

 

Related functions:

hive_close()

hive_cursor()

hive_client()