Connecting to a Presto server-Developer edition

Presto CLI provides a terminal-based interactive shell to run queries. You can connect IBM® watsonx.data developer edition Presto server through Presto CLI installed externally.

watsonx.data Developer edition

Using presto-cli in the developer edition

To connect to the presto-cli in the developer edition:

  1. Download the presto-cli executable (presto-cli-0.286-executable.jar) from Command line interface.
  2. Open a command prompt in the workstation where IBM watsonx.data developer is installed.
  3. Rename the JAR file to presto with the following command:
     mv presto-cli-0.286-executable.jar presto
  4. Use the following command to make the renamed file executable:
    chmod +x presto
  5. Use the following command to port-forward presto svc:
    nohup kubectl port-forward svc/ibm-lh-presto-svc 8443:8443 -n wxd > /dev/null 2>&1 &
  6. Use the following command to import the certificate of the Presto server to establish trust:
    echo QUIT | openssl s_client -showcerts -connect localhost:8443 | awk '/-----BEGIN CERTIFICATE-----/ {p=1}; p; /-----END CERTIFICATE-----/ {p=0}' > ./presto.cert
    keytool -import -trustcacerts -storepass changeit -noprompt -alias presto-cert -file ./presto.cert -keystore ./presto-truststore.jks
    
    Note: If alias already exists and want to remove, use the following keytool -delete -alias presto-cert -keystore ./presto-truststore.jks -storepass changeit
    The hostname should be the hostname of the server or workstation where the IBM watsonx.data developer package is installed.
  7. After successful certificate import, connect to Presto-cli using following command:
    export PRESTO_PASSWORD=password
    ./presto --server https://localhost:8443  --truststore-path ./presto-truststore.jks  --truststore-password=changeit --user ibmlhadmin --password

    Example:

    % ./presto --server https://localhost:8443  --truststore-path ./presto-truststore.jks  --truststore-password=changeit --user ibmlhadmin --password
    presto> 
    presto> show catalogs;
         Catalog     
    -----------------
     hive_data       
     iceberg_data    
     jmx             
     sample_data     
     system          
     tpcds           
     wxd_system_data 
    (7 rows)
    
    Query 20251027_043209_00031_qdxym, FINISHED, 1 node
    Splits: 19 total, 19 done (100.00%)
    [Latency: client-side: 384ms, server-side: 137ms] [0 rows, 0B] [0 rows/s, 0B/s]
    
    presto> 
    presto> 
    presto> SHOW SCHEMAS FROM sample_data;
     Schema  
    ---------
     gosales 
    (1 row)
    
    Query 20251027_043852_00033_qdxym, FINISHED, 1 node
    Splits: 19 total, 19 done (100.00%)
    [Latency: client-side: 0:01, server-side: 445ms] [1 rows, 12B] [2 rows/s, 26B/s]
    
    presto> 
    presto> SHOW TABLES FROM sample_data.gosales;
            Table         
    ----------------------
     branch               
     conversion_rate      
     country              
     currency_lookup      
     emp_expense_type_dim 
     emp_survey_fact      
     euro_conversion      
     expense_unit         
     inventory_levels     
     order_details        
     order_header         
     order_method         
     product              
     product_brand        
     product_color_lookup 
     product_forcast      
     product_line         
     product_name_lookup  
     product_size_lookup  
     product_type         
     return_item          
     return_reason        
     sales_region         
     sales_target         
     time_dimension       
     time_quarter_lookup  
     xgorev               
    (27 rows)
    
    Query 20251027_043904_00034_qdxym, FINISHED, 1 node
    Splits: 19 total, 19 done (100.00%)
    [Latency: client-side: 0:02, server-side: 0:02] [27 rows, 821B] [17 rows/s, 523B/s]
    
    presto> SELECT * FROM sample_data.gosales.country LIMIT 10;
     country_code |  country_en   |       country_cs       | country_da |     country_de     |     country_el     |   country_es   | country_fi  | country_fr |    country_hu    |   country_id    | country_it  |   coun>
    --------------+---------------+------------------------+------------+--------------------+--------------------+----------------+-------------+------------+------------------+-----------------+-------------+------->
             1003 | United States | Spojené státy americké | USA        | Vereinigte Staaten | Ηνωμένες Πολιτείες | Estados Unidos | Yhdysvallat | États-Unis | Egyesült Államok | Amerika Serikat | Stati Uniti | アメリ>
             1004 | Canada        | Kanada                 | Canada     | Kanada             | Καναδάς            | Canadá         | Kanada      | Canada     | Kanada           | Kanada          | Canada      | カナダ>
             1020 | Mexico        | Mexiko                 | Mexico     | Mexiko             | Μεξικό             | México         | Meksiko     | Mexique    | Mexikó           | Meksiko         | Messico     | メキシ>
             1021 | Brazil        | Brazílie               | Brasilien  | Brasilien          | Βραζιλία           | Brasil         | Brasilia    | Brésil     | Brazília         | Brazil          | Brasile     | ブラジ>
             4011 | Japan         | Japonsko               | Japan      | Japan              | Ιαπωνία            | Japón          | Japani      | Japon      | Japán            | Jepang          | Giappone    | 日本  >
             4012 | Singapore     | Singapur               | Singapore  | Singapur           | Σιγκαπούρη         | Singapur       | Singapore   | Singapour  | Szingapúr        | Singapura       | Singapore   | シンガ>
             4013 | Korea         | Korea                  | Korea      | Korea              | Κορέα              | Corea          | Korea       | Corée      | Dél-Korea        | Korea           | Corea       | 韓国  >
             4014 | China         | Čína                   | Kina       | China              | Κίνα               | China          | Kiina       | Chine      | Kína             | Cina            | Cina        | 中国  >
             4016 | Australia     | Austrálie              | Australien | Australien         | Αυστραλία          | Australia      | Australia   | Australie  | Ausztrália       | Australia       | Australia   | オース>
             5007 | Netherlands   | Nizozemí               | Holland    | Niederlande        | Ολλανδία           | Países Bajos   | Alankomaat  | Pays-Bas   | Hollandia        | Belanda         | Olanda      | オラン>
    (10 rows)
    
    Query 20251027_043932_00035_qdxym, FINISHED, 1 node
    Splits: 18 total, 18 done (100.00%)
    [Latency: client-side: 0:03, server-side: 0:03] [15 rows, 21.1KB] [5 rows/s, 7.33KB/s]
    
    presto> 
    presto>