Page tree
Skip to end of metadata
Go to start of metadata

Python is an object-oriented, high-level, and extremely interpreted programming language that is also known for its dynamic semantics. It is known worldwide for its immense capabilities of Rapid Application Development, especially because of dynamic binding and typing. Python jibes pretty well with data analysis, and therefore, it is touted as one of the most preferred languages for data science.

Data scientists can use Python to connect to Kyvos cubes and implement data science algorithms for predictive analysis.

This section explains how you can connect to Kyvos cubes using Python.

Prerequisites

To connect Kyvos using Python, you must have the following.

  1. Python (3 and above) must be hosted either on an analyst’s machine or on Hadoop Cluster (Cloud/On-Premises).
  2. PYODBC module 
  3. Kyvos ODBC Driver

Steps to Connect

  1. 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.
  2. Install the Kyvos ODBC driver using the system administrator credentials.
  3. Create a System DSN named KyvosDSN, as explained:
    1. For Windows
    2. For Mac OS
  4. Test the connectivity with Kyvos, and save the System DSN.
  5. Now you can start browsing the Kyvos cubes in Python Notebook.

For example:

#import the pyodbc package
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:
print(showD1)
  • No labels