Skip to main content

Connect beeline

beeline is a client for running Spark SQL queries on a Thrift Server via the command line with a JDBC connection.

  1. Tunnel into your VPC with a VPN or bastion host
  2. Download the beeline client included in the Spark 3.5.2 (with Hadoop3) distribution
  3. Find your SQL Cluster endpoint on the Cluster details page in the Onehouse console
  4. Use the beeline CLI for interactive queries with the following command (make sure to specify a database):
        $ beeline -u jdbc:hive2://<SQL-CLUSTER-ENDPOINT>:10000/<DATABASE-NAME>
    Here are some sample commands with the beeline CLI:
    1. Find an existing table in the Onehouse console or with SQL:
      $ show databases;
      $ use <database>;
      $ show tables;
    2. Query the existing table with beeline
      $ select * from <database>.<table>;
      beeline_query
  5. Use beeline to execute queries from a local file using the following command (make sure to specify a database):
        $ beeline -u jdbc:hive2://<SQL-CLUSTER-ENDPOINT>:10000/<DATABASE-NAME> -f <SQL-FILEPATH-TO-EXECUTE>
    Note: For best performance, run beeline in interactive mode (step 4) to avoid new session startup time with each query.