A package that enables interaction with a Kobai tenant.
Project description
Kobai SDK for Python (Alpha)
Alpha: This SDK is not currently supported for production use while we stabilize the interface.
The Kobai SDK for Python includes functionality to accelerate development with Python on the Kobai Semantic Layer. It does not cover all Kobai Studio features, but rather focuses on integrating a Kobai tenant with data science and AI activities on the backend.
Getting Started
This exercise demonstrates using the Kobai SDK to create a Databricks "Genie" Data Room environment, enabling users to interact with Kobai data in an AI Chat interface.
- Please install Kobai SDK for Python via
pip install kobai-sdk
, gather some configuration details of the Kobai instance and tenant to connect to, and instantiateTenantClient
:
from kobai import tenant_client, spark_client, databricks_client
schema = 'main.demo'
uri = 'https://demo.kobai.io'
tenant_id = '1'
tenant_name = 'My Demo Tenant'
k = tenant_client.TenantClient(tenant_name, tenant_id, uri, schema)
- Authenticate with the Kobai instance:
client_id = 'your_Entra_app_id_here'
tenant_id = 'your_Entra_directory_id_here'
k.authenticate(client_id, tenant_id)
- Initialize a Spark client using your current
SparkSession
, and generate semantically-rich SQL views describing this Kobai tenant:
k.spark_init_session(spark)
k.spark_generate_genie_views()
- Initialize a Databricks API client using your Notebook context, and create a Genie Data Rooms environment for this Kobai tenant.
notebook_context = dbutils.notebook.entry_point.getDbutils().notebook().getContext()
sql_warehouse = '8834d98a8agffa76'
k.databricks_init_notebook(notebook_context, sql_warehouse)
k.databricks_build_genie()
Limitations
This version of the SDK is limited to use in certain contexts, as described below:
- Authentication is limited to MS Entra AD.
- Functionality limited to Databricks Notebook environments at this time.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file kobai_sdk-0.2.5.tar.gz
.
File metadata
- Download URL: kobai_sdk-0.2.5.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a873fbae714763695b868b880de78fd7b88a0da6e31f46067410e13c793a0ce0 |
|
MD5 | 95ae427276a9c85225017b6412b77cb0 |
|
BLAKE2b-256 | 357505268b2095948467f5eee6e441e36fd49dd01321d76617635d3f6ac85be7 |
File details
Details for the file kobai_sdk-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: kobai_sdk-0.2.5-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf13f1edfab05b2141f7a5c5ecd155c1dd0132e732eaf4b8463fd426ea8b329 |
|
MD5 | 309e45da010e04111b28701a166c88d5 |
|
BLAKE2b-256 | 9b0e63809836be620efabbb777d5e66a47635cec78586178eb539a98267efb14 |