Skip to main content

Runs a SQL command on SAP HANA Cloud using OAuth single sign on and returns a pandas or polars dataframe

Project description

Usage of the hana_cloud_interface package

This package provides a simple interface to connect to SAP HANA Cloud databases and execute SQL queries. Below are some examples of how to use the package.

example

the main function is very simple It takes a SQL command as a string and returns the data

import hana_cloud_interface as hci

sql_command = """
SELECT top 10
    "data1"
    "data2"
FROM "table1"
"""
    
data = hci.hana_sql(sql_command)

initialising settings

Before using the package, you need to initialize the settings by specifying the configuration file location, browser override (if needed), and the default data frame type for SQL query results.

config_file : Path to the configuration file (JSON format) containing OAuth credentials and other settings.

Browser_override : Optional parameter to specify a browser for OAuth authentication. If left empty, the default browser will be used. this needs to be the path to the executable for the browser

data_frame_type : Default data frame type for SQL query results. Options are 'pandas' or 'polars'. Default is 'pandas'.

hci.initialize_settings(config_file = 'location of configuration file', Browser_override = '', data_frame_type = 'pandas')

the configuration file is a .json file

{
    "CLIENT_ID": "",
    "CLIENT_SECRET": "",
    "AUTH_URL": "",
    "TOKEN_URL": "",
    "protected_url": "",
    "REDIRECT_URI": "",
    "SCOPE": "",
	"HC_prod_URL": ""
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hana_cloud_interface-0.2.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hana_cloud_interface-0.2.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file hana_cloud_interface-0.2.1.tar.gz.

File metadata

File hashes

Hashes for hana_cloud_interface-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ac9838fc066ff977327a6a6941acde42039f55780c59293052d45fcda4d09608
MD5 8c58a5bfaf652f63c8fac8c4daf7f1c1
BLAKE2b-256 055a6ef2ba46f660bcd6b3099df54506f8171e71ff64d72f54b765d62ec23b85

See more details on using hashes here.

File details

Details for the file hana_cloud_interface-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hana_cloud_interface-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66ca37db231da837eabfbca3f6158676dd6848929b953444a9bf0f33cf7c3960
MD5 451a1e213d0f66f2c7706faa972f3320
BLAKE2b-256 64afab4f262c4e145b1650a76addcbe29a020f7a533e3a727c21f6008090c2de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page