Quick Start

Available with ADS v2.5.10 and greater

Set Up A Conda Environment

The following are the recommended steps to create a conda environment to connect to BDS:

  • Open a terminal window then run the following commands:

  • odsc conda install -s pyspark30_p37_cpu_v3: Install the PySpark conda environment.

  • conda activate /home/datascience/conda/pyspark30_p37_cpu_v3: Activate the PySpark conda environment so that you can modify it.

  • pip uninstall oracle_ads: Uninstall the old ADS package in this environment.

  • pip install oracle_ads[bds]: Install the latest version of ADS that contains BDS support.

  • conda install sasl: Install sasl.

Connect from a Notebook

Using the Vault

import ads
import os

from ads.bds.auth import krbcontext
from ads.secrets.big_data_service import BDSSecretKeeper
from pyhive import hive

ads.set_auth('resource_principal')
with BDSSecretKeeper.load_secret("<secret_id>") as cred:
    with krbcontext(principal=cred["principal"], keytab_path=cred['keytab_path']):
        cursor = hive.connect(host=cred["hive_host"],
                              port=cred["hive_port"],
                              auth='KERBEROS',
                              kerberos_service_name="hive").cursor()

Without Using the Vault

import ads
import fsspec
import os

from ads.bds.auth import refresh_ticket

ads.set_auth('resource_principal')
refresh_ticket(principal="<your_principal>", keytab_path="<your_local_keytab_file_path>",
               kerb5_path="<your_local_kerb5_config_file_path>")
cursor = hive.connect(host="<hive_host>", port="<hive_port>",
                      auth='KERBEROS', kerberos_service_name="hive").cursor()