ads.bds package
Submodules
ads.bds.auth module
- exception ads.bds.auth.KRB5KinitError
Bases:
Exception
KRB5KinitError class when kinit -kt command failed to generate cached ticket with the keytab file and the krb5 config file.
- ads.bds.auth.has_kerberos_ticket()
Whether kerberos cache ticket exists.
- ads.bds.auth.init_ccache_with_keytab(principal: str, keytab_file: str) None
Initialize credential cache using keytab file.
- Parameters
principal (str) – The unique identity to which Kerberos can assign tickets.
keytab_path (str) – Path to your keytab file.
- Returns
Nothing.
- Return type
None
- ads.bds.auth.krbcontext(principal: str, keytab_path: str, kerb5_path: str = '~/.bds_config/krb5.conf') None
A context manager for Kerberos-related actions. It provides a Kerberos context that you can put code inside. It will initialize credential cache automatically with keytab if no cached ticket exists. Otherwise, does nothing.
- Parameters
principal (str) – The unique identity to which Kerberos can assign tickets.
keytab_path (str) – Path to your keytab file.
kerb5_path ((str, optional).) – Path to your krb5 config file.
- Returns
Nothing.
- Return type
None
Examples
>>> from ads.bds.auth import krbcontext >>> from pyhive import hive >>> with krbcontext(principal = "your_principal", keytab_path = "your_keytab_path"): >>> hive_cursor = hive.connect(host="your_hive_host", ... port="your_hive_port", ... auth='KERBEROS', ... kerberos_service_name="hive").cursor()
- ads.bds.auth.refresh_ticket(principal: str, keytab_path: str, kerb5_path: str = '~/.bds_config/krb5.conf') None
generate new cached ticket based on the principal and keytab file path.
- Parameters
principal (str) – The unique identity to which Kerberos can assign tickets.
keytab_path (str) – Path to your keytab file.
kerb5_path ((str, optional).) – Path to your krb5 config file.
- Returns
Nothing.
- Return type
None
Examples
>>> from ads.bds.auth import refresh_ticket >>> from pyhive import hive >>> refresh_ticket(principal = "your_principal", keytab_path = "your_keytab_path") >>> hive_cursor = hive.connect(host="your_hive_host", ... port="your_hive_port", ... auth='KERBEROS', ... kerberos_service_name="hive").cursor()