Applies to: Kyvos Enterprise Kyvos Cloud (SaaS on AWS) Kyvos AWS Marketplace
Kyvos Azure Marketplace Kyvos GCP Marketplace Kyvos Single Node Installation (Kyvos SNI)
This section explains how you can connect Python to Kyvos semantic models using SQL connection.
Prerequisites
To connect Kyvos using Python, you must have the following.
Python (3 and above) must be hosted either on an analyst’s machine or on Hadoop Cluster (Cloud/On-Premises).
PYODBC module
Kyvos ODBC Driver
Steps to connect
Download the Kyvos ODBC driver from https://www.kyvosinsights.com/kyvos-odbc-driver/
You will be asked to register yourself to download the driver and the Installation Guide to set up the driver.Install the Kyvos ODBC driver using the system administrator credentials.
Create a System DSN named KyvosDSN, as explained:
Test the connectivity with Kyvos, and save the System DSN.
Now you can start browsing the Kyvos semantic models in Python Notebook.
For example:
import pyodbc #connection string cnxn = pyodbc.connect('DSN=KyvosDSN;UID=xxxx;PWD=xxxx', autocommit=True) cursor = cnxn.cursor() #execute the prepared SQL statement cursor.execute("SELECT `ssb`.`brand1` AS `brand1`, SUM(`ssb`.`profit`) AS `sum_profit_ok` FROM `kyvos_browsing_automationcubes`.`ssb` `ssb` WHERE ((`ssb`.`mfgr` = 'MFGR#3') AND (`ssb`.`region` = 'ASIA')) GROUP BY `ssb`.`brand1`") #iterate the results D1=cursor.fetchall() for showD1 in D1: