leon jouet
10/02/2024, 2:57 PMNok Lam Chan
10/02/2024, 3:05 PMleon jouet
10/02/2024, 3:10 PMfrom hana_ml import dataframe
def create_conn_sap_dwc(env_conn:str = 'PROD'):
#Datasphere PRod Connection
if env_conn=='PROD':
dbHost=DBHOST_PROD
display (DBHOST_PROD)
dbPort=DBPORT_PROD
dbUser=DBUSER_PROD
dbPwd=dbutils.secrets.get(scope=SCOPE_PROD,key=KEY_PROD)
display (dbPwd)
conn = dataframe.ConnectionContext(dbHost, dbPort, dbUser, dbPwd, encrypt=True, sslValidateCertificate=True)
return conn
cc = create_conn_sap_dwc()
sql_code = "MY SQL CODE"
result = cc.sql(sql_code)
df = result.collect()
Nok Lam Chan
10/02/2024, 3:54 PMpandas.SQLQueryDataset
as long as you get the connection right.
2. ^ if above doesn't work, you can make a custom dataset inherit the above. I won't expect there to be too much changes, the main thing here is just getting the connection right and then passing sql around.leon jouet
10/02/2024, 4:12 PMleon jouet
10/10/2024, 2:19 PMNok Lam Chan
10/10/2024, 2:28 PMNok Lam Chan
10/10/2024, 2:43 PM