Skip to content

Commit 5ec48f2

Browse files
authored
Merge pull request #24 from AmedeeBulle/ga
GA Updates
2 parents 54dac41 + 6546d87 commit 5ec48f2

File tree

6 files changed

+25
-17
lines changed

6 files changed

+25
-17
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Oracle Internet of Things Platform Samples
22

3-
This repository provides examples demonstrating how to use the Oracle Internet of Things
4-
Platform.
3+
This repository provides examples demonstrating how to use the
4+
[Oracle Internet of Things Platform](https://docs.oracle.com/en-us/iaas/Content/internet-of-things/).
55

66
## Setup
77

@@ -62,7 +62,7 @@ as well as the messages received.
6262
## Documentation
6363

6464
You can find the online documentation for the Oracle Internet of Things Platform at
65-
[docs.cloud.oracle.com](https://docs.cloud.oracle.com/).
65+
[docs.cloud.oracle.com](https://docs.oracle.com/en-us/iaas/Content/internet-of-things/).
6666

6767
## Contributing
6868

samples/python/manage-dt/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
python_requires=">=3.12",
3636
install_requires=[
3737
"click~=8.2.0",
38-
"oci~=2.158",
38+
"oci~=2.0,>=2.161",
3939
"PyYAML~=6.0.0",
4040
"requests~=2.32.0",
4141
"rich~=13.0.0",

samples/python/query-db/README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,25 @@
33
The OCI Internet of Things Platform allows you to connect directly to the
44
database storing your Digital Twin definitions and telemetry.
55

6-
This guide shows how to connect to your IoT database using a Python script.
6+
The
7+
[Scenario: Connecting Directly to the IoT Database](https://docs.oracle.com/en-us/iaas/Content/internet-of-things/connect-database.htm)
8+
section of the documentation shows how to establish a database connection with
9+
[SQLcl](https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/).
10+
This guide focuses on how to connect to your IoT database using a Python script.
711

812
## Concepts
913

1014
Each IoT Domain Group uses an Oracle Autonomous Database, which is shared by
1115
all IoT Domains in that group.
1216

13-
To access the database, you must ensure that your client IP address is
17+
To access the database, you must ensure that your client VCN is
1418
included in the Allow List defined at the IoT Domain Group level –
15-
[Documentation](.).
19+
[Documentation](https://docs.oracle.com/en-us/iaas/Content/internet-of-things/connect-database.htm#top__create-vcn).
1620

1721
When connected, to access the database schemas related to a particular IoT
1822
Domain, the OCI user initiating the connection must be part of one of the
19-
identity groups listed at the IoT Domain level – [Documentation](.).
23+
Identity Domain (Dynamic) Groups listed at the IoT Domain level –
24+
[Documentation](https://docs.oracle.com/en-us/iaas/Content/internet-of-things/connect-database.htm#top__identity-domain).
2025

2126
Database authentication is handled using
2227
[OCI Identity Database Tokens](https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/iam-access-database.html#GUID-CFC74EAF-E887-4B1F-9E9A-C956BCA0BEA9).
@@ -27,10 +32,6 @@ The user account running the script must be properly configured to retrieve
2732
oci iam db-token get --scope "urn:oracle:db::id::*"
2833
```
2934

30-
While the OCI IoT Platform also supports _Instance Principal_ authentication,
31-
this example uses the default API Key Authentication configured in the
32-
`~/.oci/config` file.
33-
3435
The `oracledb` Python module handles token retrieval seamlessly when
3536
specifying `extra_auth_params=token_based_auth` at connection time.
3637

@@ -63,7 +64,9 @@ Copy `config.distr.py` to `config.py` and set the following variables:
6364
- `db_connect_string`: The dbConnectionString property of your IoT Domain Group.
6465
- `db_token_scope`: The dbTokenScope property of your IoT Domain Group.
6566
- `iot_domain_short_name`: The hostname part of the deviceHost property of your IoT Domain.
66-
- `oci_profile`: OCI CLI profile to use for token retrieval.
67+
- `oci_auth_type`: The OCI Authentication type. Must be either "ConfigFileAuthentication"
68+
for API Key authentication or "InstancePrincipal".
69+
- `oci_profile`: OCI CLI profile to use for token retrieval when using API Key authentication.
6770
- `row_count`: The number of rows retrieved by the sample queries.
6871
- `thick_mode`: Set to `True` to use the `oracledb` Thick mode driver.
6972

samples/python/query-db/config.distr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
# jq -r '.'data."device-host"' | split(".")[0]'
1717
iot_domain_short_name = "<Domain SHort Name>"
1818

19-
# OCI CLI profile to use for token retrieval.
19+
# OCI Authentication type. Must be either "ConfigFileAuthentication" or "InstancePrincipal"
20+
# oci_auth_type = "ConfigFileAuthentication"
21+
oci_auth_type = "InstancePrincipal"
22+
23+
# OCI CLI profile to use for token retrieval when authentication type is "ConfigFileAuthentication"
2024
oci_profile = os.getenv("OCI_CLI_PROFILE", "DEFAULT")
2125

2226
# Number of rows to retrieve in the sample queries.

samples/python/query-db/query_db.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ def get_blob(blob: oracledb.LOB) -> Tuple[str, str]:
8585

8686
# Parameters for OCI token-based authentication
8787
token_based_auth = {
88-
"auth_type": "ConfigFileAuthentication",
89-
"profile": config.oci_profile,
88+
"auth_type": config.oci_auth_type,
9089
"scope": config.db_token_scope,
9190
}
91+
if config.oci_auth_type == "ConfigFileAuthentication":
92+
token_based_auth["profile"] = config.oci_profile
9293

9394
extra_connect_params = {}
9495
if config.thick_mode:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
oci
1+
oci~=2.0,>=2.161
22
oracledb>=3.2.0

0 commit comments

Comments
 (0)