-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathprofile_run_sql.py
More file actions
26 lines (21 loc) · 932 Bytes
/
Copy pathprofile_run_sql.py
File metadata and controls
26 lines (21 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -----------------------------------------------------------------------------
# Copyright (c) 2025, Oracle and/or its affiliates.
#
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# profile_run_sql.py
#
# Return a pandas.Dataframe built using the resultset of the generated SQL
# -----------------------------------------------------------------------------
import os
import select_ai
user = os.getenv("SELECT_AI_USER")
password = os.getenv("SELECT_AI_PASSWORD")
dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
select_ai.connect(user=user, password=password, dsn=dsn)
profile = select_ai.Profile(profile_name="oci_ai_profile")
df = profile.run_sql(prompt="How many promotions ?")
print(df.columns)
print(df)