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.1.8.tar.gz (4.5 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.1.8-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for hana_cloud_interface-0.1.8.tar.gz
Algorithm Hash digest
SHA256 be2b944a9e8714a6b106931c87a23573eebe70addf8c432314698fce393f2591
MD5 f26f12971867e0c71e2c1fc36e7df56e
BLAKE2b-256 c7586984bb612984c534b977cdabbc6478c94571f972f2a392826398f2b97a79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hana_cloud_interface-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 adcb71408e8f5cdee2162b253174da7e487251b3afe917f06bcd9df6d0510e5c
MD5 f4989fb3e4ec4bc8c0b213f7a5d21925
BLAKE2b-256 33d5c086c31a8dc19f0abd80fa101ca9b9bc65c3af77b06d8ec13550ec74d97b

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