Details
# Oracle AI Data Platform Workbench — Spark Connectors
> **Canonical home:** [`oracle-samples/oracle-aidp-samples/ai/claude-code-plugins/oracle-ai-data-platform-workbench-spark-connectors`](https://github.com/oracle-samples/oracle-aidp-samples/tree/main/ai/claude-code-plugins/oracle-ai-data-platform-workbench-spark-connectors).
> This repository is now a personal development mirror. End users should install via Anthropic's community marketplace (see below), which sources from the canonical Oracle-org location.
A Claude Code plugin that ships **26 model-invokable skills** for connecting Oracle AI Data Platform Workbench Apache Spark notebooks to every data source these notebooks commonly need. Each skill produces plain Python (Spark JDBC, Spark structured streaming, Spark `oci://`/`s3a://`/`abfss://`, or REST → Spark DataFrame) that runs in the notebook without any additional runtime.
**v0.7.0** adds Db2 guidance for the AIDP 4.1 connector release. Snowflake and NetSuite remain read-only.
All connectors wrap the official AIDP `aidataplatform` Spark format handler (or, where applicable, Spark JDBC / structured streaming / `oci://`/`s3a://`/`abfss://`) — same patterns shown in the upstream [`oracle-samples/oracle-aidp-samples`](https://github.com/oracle-samples/oracle-aidp-samples) connector notebooks.
## Install
From Anthropic's community plugin marketplace:
```
/plugin marketplace add anthropics/claude-plugins-community
/plugin install oracle-ai-data-platform-workbench-spark-connectors
```
## What's in here
28 skills total (26 connectors + 1 bootstrap + 1 routing).
### Oracle / OCI sources
| Skill | Target | Transport | Recommended auth |
|---|---|---|---|
| `aidp-connectors-overview` | (router) | — | — |
| `aidp-connectors-bootstrap` | one-time setup | — | — |
| `aidp-alh` | Oracle Autonomous DB family (ALH / ADW / ATP) | Spark JDBC | Wallet (mTLS), IAM DB-Token, or API key |
| `aidp-oracle-db` | Generic Oracle DB (Compute / Base DB / on-prem / 19c-26ai non-Autonomous) | `aidataplatform` (`type=ORACLE_DB`) | Plain user/password |
| `aidp-exacs` | Exadata Cloud Service | Spark JDBC (TCP 1521 + NNE AES256) | Plain user/password |
| `aidp-peoplesoft` | Oracle PeopleSoft | `aidataplatform` (`type=ORACLE_PEOPLESOFT`) | Plain user/password (read-only) |
| `aidp-siebel` | Oracle Siebel CRM | `aidataplatform` (`type=ORACLE_SIEBEL`) | Plain user/password (read-only) |
| `aidp-fusion-rest` | Fusion ERP/HCM/SCM | REST → DataFrame | HTTP Basic |
| `aidp-fusion-bicc` | Fusion BICC bulk extracts | `aidataplatform` (`type=FUSION_BICC`) | HTTP Basic |
| `aidp-epm-cloud` | EPM Cloud Planning | REST → DataFrame | HTTP Basic (`tenancy.user@domain`) |
| `aidp-essbase` | Essbase 21c | REST + MDX → DataFrame | HTTP Basic |
| `aidp-streaming-kafka` | OCI Streaming | Spark structured streaming | SASL/PLAIN with OCI auth token |
| `aidp-object-storage` | OCI Object Storage native | Spark `oci://` | Implicit IAM (workspace identity) |
| `aidp-iceberg` | Apache Iceberg on OCI Object Storage | Iceberg Hadoop catalog on `oci://` | Implicit IAM |
### External RDBMS / Hadoop (`aidataplatform` format)
| Skill | Target | Transport | Recommended auth |
|---|---|---|---|
| `aidp-postgresql` | PostgreSQL | Spark JDBC (runtime-loaded driver) for SSL targets, `aidataplatform` `type=POSTGRESQL` for non-SSL | Plain user/password |
| `aidp-mysql` | MySQL / OCI MySQL HeatWave | `aidataplatform` (`type=MYSQL` or `MYSQL_HEATWAVE`) | Plain user/password |
| `aidp-sqlserver` | Microsoft SQL Server | `aidataplatform` (`type=SQLSERVER`) | Plain user/password |
| `aidp-azuresql` | Azure SQL Database | `aidataplatform` (`type=AZURE_SQLSERVER`) | Plain user/password |
| `aidp-db2` ⭐ NEW | IBM Db2 | `aidataplatform` (`type=DB2`) | Plain user/password |
| `aidp-hive` | Apache Hive (HiveServer2, non-Kerberos) | `aidataplatform` (`type=HIVE`) | Plain user/password |
### SaaS
| Skill | Target | Transport | Recommended auth |
|---|---|---|---|
| `aidp-salesforce` | Salesforce (Sales/Service Cloud, custom sObjects) | `aidataplatform` (`type=SFORCE`) | Username + password+security-token (read-only) |
| `aidp-netsuite` | NetSuite SuiteAnalytics Connect (read-only) | `aidataplatform` (`type=NETSUITE`) | Username/password or OAuth access token |
### Multi-cloud + escape hatches
| Skill | Target | Transport | Recommended auth |
|---|---|---|---|
| `aidp-snowflake` | Snowflake (read-only) | `aidataplatform` (`type=SNOWFLAKE`) | Basic or KeyPair |
| `aidp-azure-adls` | Azure ADLS Gen2 | Spark `abfss://` | OAuth client-credentials (Service Principal) |
| `aidp-aws-s3` | Amazon S3 | Spark `s3a://` (runtime-loaded `hadoop-aws` + `aws-java-sdk-bundle`) | AWS access keys |
| `aidp-rest-generic` | Any REST API with a manifest URL or Volume `manifest.path` | `aidataplatform` (`type=GENERIC_REST`) | HTTP Basic |
| `aidp-jdbc-custom` | Any DB with a JDBC driver | Spark `format("jdbc")` (runtime-loaded driver) | Driver-specific |
| `aidp-excel` | `.xlsx` files in Volumes / Object Storage | stdlib `zipfile` + XML parser (no extra deps) | None (file-based) |
### v0.5.0 cross-cutting patterns
The new oracle-samples PR #46 introduced three patterns that are wired into every applicable skill:
| Pattern | What it does |
|---|---|
| `pushdown.sql` | Push a complete source SQL query at the database — replaces schema/table option building. Useful for joins, filters, derived columns, and bulk-table avoidance. |
| `catalog.id` | Reference an existing AIDP external catalog connection by id — drops host/port/user/password from the option list. Pairs with three-part `spark.table()` / `saveAsTable()` for the cleanest read/write code. |
| `manifest.path` | (REST only) Reference a manifest file by workspace/Volume path instead of HTTP URL. Lets manifests be hand-authored and version-pinned alongside the notebook. |
## How to use
### First-time setup (once per workbench workspace)
Tell Claude:
> "Set up the Oracle AI Data Platform Workbench connectors plugin in this workspace."
The `aidp-connectors-bootstrap` skill activates, uses the workbench MCP tools to upload the helper package to `/Workspace/Shared/oracle_ai_data_platform_connectors/`, then runs [`examples/00_bootstrap_helpers.ipynb`](examples/00_bootstrap_helpers.ipynb) which prints `BOOTSTRAP OK` when the package imports cleanly.
(Manual alternative: upload `scripts/oracle_ai_data_platform_connectors/` to `/Workspace/Shared/oracle_ai_data_platform_connectors/scripts/oracle_ai_data_platform_connectors/` via the workbench UI, then run the bootstrap notebook.)
### Day-to-day
In a Claude Code session against your Oracle AI Data Platform Workbench workspace, just describe what you want:
> "I need to load ATP data into Spark in my Oracle AI Data Platform Workbench notebook"
The relevant connector skill activates automatically and walks you through:
1. **Prerequisites** — env vars / OCI Vault secrets, JDBC jar runtime-load if needed.
2. **Auth options** — pick one (wallet, IAM DB-Token, API key + inline PEM, HTTP Basic, OAuth, AWS keys, Service Principal).
3. **Code** — Spark JDBC / REST / streaming snippet ready to paste into a notebook cell.
4. **Gotchas** — known constraints captured from live testing (FUSE write modes, SSL handling, runtime-load classloader, executor distribution, etc.).
### Examples
Per-connector example notebooks are under [`examples/`](examples/) — one per (skill, auth) combo. The full live-test results matrix is in [`tests/live-results/RESULTS.md`](tests/live-results/RESULTS.md).
## Sample run (Oracle EPM Cloud)
```python
import os
from oracle_ai_data_platform_connectors.auth import http_basic_session
from oracle_ai_data_platform_connectors.rest.epm import (
list_applications, export_data_slice, slice_to_long_dataframe,
)
# EPM_USERNAME MUST be in identity-domain form: tenancy.user@domain
# (e.g. mytenancy.first.last@example.com — the bare email returns 401)
session = http_basic_session(
username=os.environ["EPM_USERNAME"],
password=os.environ["EPM_PASSWORD"],
base_url=os.environ["EPM_BASE_URL"],
)
# Pre-flight: confirm credentials work and the app is reachable
apps = list_applications(session, os.environ["EPM_BASE_URL"])
print("applications:", [a["name"] for a in apps])
# Export a Planning data slice (POV × columns × rows)
slice_response = export_data_slice(
session=session,
base_url=os.environ["EPM_BASE_URL"],
application=os.environ["EPM_APPLICATION"],
plan_type=os.environ["EPM_PLAN_TYPE"],
grid_definition={
"suppressMissingBlocks": True,
"suppressMissingRows": True,
"pov": {
"dimensions": ["HSP_View", "Year", "Scenario", "Version", "Entity", "Product"],
"members": [["BaseData"], ["FY26"], ["Actual"], ["Working"], ["Total Entity"], ["P_TP"]],
},
"columns": [{"dimensions": ["Period"], "members": [["Jan", "Feb", "Mar", "Apr", "May", "Jun"]]}],
"rows": [{"dimensions": ["Account"], "members": [["IChildren(PL)"]]}],
},
)
# Materialize as a long-format Spark DataFrame (one row per cell)
df = slice_to_long_dataframe(spark, slice_response)
df.show(10)
print("cells:", df.count())
```
The `aidp-epm-cloud` skill prints exactly this snippet (with your env vars and grid spec substituted) when you ask Claude to pull Planning data into Spark. POV members must be leaf-level — use `IChildren()` / `ILvl0Descendants()` for parents. Empty cells come back as the literal string `"#Missing"` in the `value` column; cast to numeric and filter as needed.
## Auth methods that Oracle AI Data Platform Workbench notebooks do NOT support today
- **Instance Principal** — the workbench blocks the OCI instance-metadata service; `InstancePrincipalsSecurityTokenSigner()` fails.
- **Resource Principal** — the workbench sets `AIDP_AUTH=resource_principal` but does not provide `OCI_RESOURCE_PRINCIPAL_RPST` or `OCI_RESOURCE_PRINCIPAL_PRIVATE_PEM`.
The skills surface these as a known limitation and route users to **API Key + inline PEM** (`aidp_connectors.auth.oci_config.from_inline_pem`) instead. Background: https://github.com/oracle-samples/oracle-aidp-samples and the workbench team's notebook-auth investigation.
## Plugin development
The `skills/` directory is a materialized copy of the shared source in
[`../../shared-plugin-content/oracle-ai-data-platform-workbench-spark-connectors/skills`](../../shared-plugin-content/oracle-ai-data-platform-workbench-spark-connectors/skills).
Edit shared skills there first, then run:
```bash
python3 ai/shared-plugin-content/oracle-ai-data-platform-workbench-spark-connectors/sync_skills.py
```
```bash
# Validate plugin shape
claude plugin validate .
# Run unit tests (no live OCI calls)
python -m pytest tests/ -v
# Live-test a connector against the workbench
oci session authenticate --profile AIDP_SESSION --region us-ashburn-1
# Open examples/<connector>_*.ipynb in your Oracle AI Data Platform Workbench workspace and run
```
Live-validation infrastructure is documented in [`tools/live_test_driver.py`](tools/live_test_driver.py); per-row results are in [`tests/live-results/`](tests/live-results/).
## Versioning + changelog
This plugin follows [SemVer](https://semver.org/). Release notes for every version live in [`CHANGELOG.md`](CHANGELOG.md).
## License
MIT — see [`LICENSE`](LICENSE).
## skills/aidp-alh/SKILL.md
---
name: aidp-alh
description: Connect from an AIDP notebook to Oracle AI Lakehouse (ALH), Autonomous Data Warehouse (ADW), or Autonomous Transaction Processing (ATP). Prefer the AIDP `aidataplatform` Spark format handler for wallet/password and catalog.id paths (`ORACLE_ALH` / `ORACLE_ATP`), but use raw Spark JDBC for IAM DB-token because the AIDP connector does not support DB-token auth yet.
allowed-tools: Read, Write, Edit, Bash
---
# `aidp-alh` — Oracle AI Lakehouse / ADW / ATP via AIDP `aidataplatform`
This skill covers the **entire Oracle Autonomous Database family** using the official AIDP ingestion connectors. Use `ORACLE_ALH` for Oracle AI Lakehouse / ADW-style connections and `ORACLE_ATP` when the user specifically wants ATP.
If the user names ATP or ADW specifically, just use this skill — substitute the env-var prefix (`ATP_*` / `ADW_*`) for `ALH_*` and proceed identically.
## When to use
- User wants to read or write an ALH, ADW, or ATP table from an AIDP notebook.
- User mentions: "ALH", "AI Lakehouse", "ADW", "Autonomous Data Warehouse", "ATP", "Autonomous Transaction Processing", "Autonomous Database", "26ai lakehouse", "lakehouse external catalog".
- User has wallet content/path, a TNS alias, DB username/password, or an existing AIDP external catalog id.
## When NOT to use
- For ExaCS → use [`aidp-exacs`](../aidp-exacs/SKILL.md).
- For non-Autonomous Oracle Database → use [`aidp-oracle-db`](../aidp-oracle-db/SKILL.md).
## Prerequisites in the AIDP notebook
1. AIDP cluster with the built-in `aidataplatform` Spark format handler.
2. One of: base64 wallet content, wallet zip at a Workspace/Volume path, an existing external catalog id, or IAM DB-token requirements for the raw JDBC exception path.
3. Env vars / OCI Vault secrets:
- `ALH_WALLET_CONTENT` or `ALH_WALLET_PATH`
- `ALH_TNS`, `ALH_USER`, `ALH_PASSWORD`
- `ALH_SCHEMA`, `ALH_TABLE`
- optional `ALH_CATALOG_ID`
## Read (inline connector options)
```python
import os
from oracle_ai_data_platform_connectors.aidataplatform import (
AIDP_FORMAT, aidataplatform_options,
)
opts = aidataplatform_options(
type=os.environ.get("ALH_CONNECTOR_TYPE", "ORACLE_ALH"), # use ORACLE_ATP for ATP
user=os.environ["ALH_USER"],
password=os.environ["ALH_PASSWORD"],
schema=os.environ["ALH_SCHEMA"],
table=os.environ["ALH_TABLE"],
extra={
"wallet.content": os.environ["ALH_WALLET_CONTENT"],
"tns": os.environ["ALH_TNS"],
},
)
df = spark.read.format(AIDP_FORMAT).options(**opts).load()
df.show()
```
## Read using `wallet.path`
```python
opts = aidataplatform_options(
type="ORACLE_ALH",
user=os.environ["ALH_USER"],
password=os.environ["ALH_PASSWORD"],
schema=os.environ["ALH_SCHEMA"],
table=os.environ["ALH_TABLE"],
extra={
"wallet.path": os.environ["ALH_WALLET_PATH"], # /Workspace/... or /Volumes/...
"tns": os.environ["ALH_TNS"],
},
)
df = spark.read.format(AIDP_FORMAT).options(**opts).load()
```
## Write (inline connector options)
```python
opts["table"] = os.environ["ALH_TARGET_TABLE"]
opts["write.mode"] = os.environ.get("ALH_WRITE_MODE", "APPEND") # CREATE | APPEND | OVERWRITE | MERGE
df.write.format(AIDP_FORMAT).options(**opts).save()
```
## Use an existing external catalog (`catalog.id`)
```python
catalog_opts = aidataplatform_options(
type="ORACLE_ALH",
schema=os.environ["ALH_SCHEMA"],
table=os.environ["ALH_TABLE"],
extra={"catalog.id": os.environ["ALH_CATALOG_ID"]},
)
df = spark.read.format(AIDP_FORMAT).options(**catalog_opts).load()
df.write.format(AIDP_FORMAT).options(
**{
"catalog.id": os.environ["ALH_CATALOG_ID"],
"schema": os.environ["ALH_SCHEMA"],
"table": os.environ["ALH_TARGET_TABLE"],
"write.mode": "APPEND",
}
).save()
```
For external-catalog table access, three-part names are also supported:
```python
df = spark.table(f"{os.environ['ALH_CATALOG_ID']}.{os.environ['ALH_SCHEMA']}.{os.environ['ALH_TABLE']}")
df.write.mode("append").insertInto(
f"{os.environ['ALH_CATALOG_ID']}.{os.environ['ALH_SCHEMA']}.{os.environ['ALH_TARGET_TABLE']}"
)
```
## Pushdown
```python
pushdown_opts = aidataplatform_options(
type="ORACLE_ALH",
user=os.environ["ALH_USER"],
password=os.environ["ALH_PASSWORD"],
extra={
"wallet.content": os.environ["ALH_WALLET_CONTENT"],
"tns": os.environ["ALH_TNS"],
"pushdown.sql": "SELECT * FROM HR.EMPLOYEES WHERE DEPARTMENT_ID = 10",
},
)
df = spark.read.format(AIDP_FORMAT).options(**pushdown_opts).load()
```
## IAM DB-token exception (raw Spark JDBC)
AIDP's built-in `aidataplatform` connector does **not** support IAM DB-token auth yet. If the user explicitly needs DB-token, use raw Spark JDBC with the helper package:
```python
import os
from oracle_ai_data_platform_connectors.auth import generate_db_token
from oracle_ai_data_platform_connectors.auth.dbtoken import refresh_on_executors
from oracle_ai_data_platform_connectors.jdbc import (
build_oracle_jdbc_url, spark_jdbc_options_dbtoken,
)
token_dir = generate_db_token(
compartment_ocid=os.environ["ALH_COMPARTMENT_OCID"],
target_dir="/tmp/dbcred_alh",
)
url = build_oracle_jdbc_url(
tns_alias=os.environ["ALH_TNS"],
tns_admin=os.environ["ALH_WALLET_DIR"], # extracted wallet directory under /tmp
)
opts = spark_jdbc_options_dbtoken(url=url, token_dir=token_dir)
df = (
spark.read.format("jdbc")
.options(**opts)
.option("dbtable", f"{os.environ['ALH_SCHEMA']}.{os.environ['ALH_TABLE']}")
.load()
)
df.show()
# For long-running jobs, refresh the DB token on executors before partition work.
refresh = refresh_on_executors(spark, os.environ["ALH_COMPARTMENT_OCID"], token_dir)
```
## Gotchas
- Prefer `catalog.id` when the connection already exists in AIDP; it keeps host, wallet, and credentials out of generated notebooks.
- For source-side filtering, prefer `pushdown.sql` for precise Oracle SQL semantics, or DataFrame `.select(...).filter(...).limit(...)` when automatic pushdown is enough.
- Use `wallet.content` or `wallet.path` with the built-in connector; do not materialize wallets into `/tmp` unless you are intentionally falling back to raw Spark JDBC.
- IAM DB-token is the main intentional raw JDBC fallback because `aidataplatform` does not support it yet.
- `ORACLE_ALH` and `ORACLE_ATP` are separate connector type literals. Use `ORACLE_ATP` when adapting the ATP sample exactly.
- Instance Principal / Resource Principal are blocked in AIDP notebooks today (IMDS unreachable, RP tokens not provided). Do not try `InstancePrincipalsSecurityTokenSigner()`.
## References
- Helper: [scripts/oracle_ai_data_platform_connectors/aidataplatform.py](../../scripts/oracle_ai_data_platform_connectors/aidataplatform.py)
- Official ALH sample: [data-engineering/ingestion/Read_Write_Oracle_Ecosystem_Connectors/Autonomous_AI_Lakehouse.ipynb](../../../../../data-engineering/ingestion/Read_Write_Oracle_Ecosystem_Connectors/Autonomous_AI_Lakehouse.ipynb)
- Official ATP sample: [data-engineering/ingestion/Read_Write_Oracle_Ecosystem_Connectors/Autonomous_Transaction_Processing.ipynb](../../../../../data-engineering/ingestion/Read_Write_Oracle_Ecosystem_Connectors/Autonomous_Transaction_Processing.ipynb)
- AIDP notebook auth limits: `Claude context/AIDP/AIDP Context/AIDP/aidp-notebook-authentication.md`
## skills/aidp-aws-s3/SKILL.md
---
name: aidp-aws-s3
description: Read and write AWS S3 (`s3a://`) from an AIDP notebook. Use when the user mentions S3, AWS S3 bucket, s3a, or has AWS access keys. Auth is access key + secret key via the Hadoop S3A connector. boto3 is also available for non-Spark management operations (list, copy).
allowed-tools: Read, Write, Edit, Bash
---
# `aidp-aws-s3` — AWS S3 via the S3A connector
Read or write `s3a://<bucket>/<key>` paths from AIDP Spark using AWS access keys. Optional `boto3` path for management operations (list, copy, head).
## When to use
- AIDP needs to consume or land data in AWS S3.
- Mentioned: "S3", "s3a", "AWS bucket".
## When NOT to use
- For OCI Object Storage → [`aidp-object-storage`](../aidp-object-storage/SKILL.md).
- For Azure ADLS Gen2 → [`aidp-azure-adls`](../aidp-azure-adls/SKILL.md).
## Cluster prerequisite — runtime-load BOTH `hadoop-aws` and `aws-java-sdk-bundle`
The AIDP `tpcds` cluster does NOT have `org.apache.hadoop.fs.s3a.S3AFileSystem` pre-installed (verified live 2026-04-27). Both `hadoop-aws-<ver>.jar` (~1 MB) AND `aws-java-sdk-bundle-<ver>.jar` (~280 MB) must be runtime-loaded. **Match `hadoop-aws` to the cluster's exact Hadoop version** (`spark._jvm.org.apache.hadoop.util.VersionInfo.getVersion()` — typically `3.3.4` for Spark 3.5.0). Mismatch produces `NoSuchMethodError` deep in `org.apache.hadoop.fs.s3a`.
Beyond the standard runtime-load + DriverManager pattern, S3A also requires telling Hadoop's Configuration which classloader to use — Hadoop's `FileSystem.get()` uses `Configuration.getClassLoader()`, not the JVM thread context loader.
## Spark read (S3A, runtime-loaded driver)
```python
import hashlib, os, urllib.request
from py4j.java_gateway import java_import
# 1. Confirm cluster's Hadoop version + match hadoop-aws jar
HADOOP_VER = spark._jvm.org.apache.hadoop.util.VersionInfo.getVersion()
print("hadoop:", HADOOP_VER) # e.g. 3.3.4
# (url, expected sha256). Pin the digest of every jar you load; for a Hadoop version
# not listed, the first run prints the digest so you can add it.
JARS = {
f"/tmp/hadoop-aws-{HADOOP_VER}.jar": (
f"https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-aws/{HADOOP_VER}/hadoop-aws-{HADOOP_VER}.jar",
{"3.3.4": "53f9ae03c681a30a50aa17524bd9790ab596b28481858e54efd989a826ed3a4a"}.get(HADOOP_VER)),
"/tmp/aws-java-sdk-bundle-1.12.262.jar": (
"https://repo1.maven.org/maven2/com/amazonaws/aws-java-sdk-bundle/1.12.262/aws-java-sdk-bundle-1.12.262.jar",
"873fe7cf495126619997bec21c44de5d992544aea7e632fdc77adb1a0915bae5"),
}
for path, (url, sha256) in JARS.items():
if not os.path.exists(path):
urllib.request.urlretrieve(url, path)
digest = hashlib.sha256(open(path, "rb").read()).hexdigest()
if sha256 is None:
print(f"{path}: sha256 {digest} (pin this before reusing the snippet)")
elif digest != sha256:
os.remove(path)
raise RuntimeError(f"checksum mismatch for {url}")
# 2. Build URLClassLoader covering BOTH jars + set on Hadoop Configuration
gw = spark._sc._gateway
URLArr = gw.new_array(spark._jvm.java.net.URL, len(JARS))
for i, p in enumerate(JARS):
URLArr[i] = spark._jvm.java.io.File(p).toURI().toURL()
sysCL = spark._jvm.java.lang.ClassLoader.getSystemClassLoader()
ucl = spark._jvm.java.net.URLClassLoader(URLArr, sysCL)
hconf = spark._jsc.hadoopConfiguration()
hconf.setClassLoader(ucl) # CRITICAL — Hadoop FileSystem lookup uses this, not the thread context
# 3. Configure S3A credentials + endpoint
hconf.set("fs.s3a.access.key", os.environ["S3_ACCESS_KEY"])
hconf.set("fs.s3a.secret.key", os.environ["S3_SECRET_KEY"])
hconf.set("fs.s3a.endpoint", "s3.amazonaws.com") # or s3.<region>.amazonaws.com
hconf.set("fs.s3a.aws.credentials.provider",
"org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider")
hconf.set("fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem")
# 4. Distribute the jars to executors (driver-only registration won't work for cluster reads)
for p in JARS:
spark._jsc.addJar(p)
# 5. Read — works for csv/json/parquet/delta
df = spark.read.option("header", "true").csv(
f"s3a://{os.environ['S3_BUCKET']}/{os.environ['S3_FILE']}"
)
df.show()
```
**Live-validated 2026-04-27**: 2 rows from `s3a://<bucket>/csv/sample.csv` via this pattern.
## boto3 fallback (management ops, not data plane)
```python
import boto3, os
s3 = boto3.client(
"s3",
aws_access_key_id = os.environ["S3_ACCESS_KEY"],
aws_secret_access_key = os.environ["S3_SECRET_KEY"],
region_name = os.environ.get("S3_REGION", "us-east-1"),
)
resp = s3.list_objects_v2(Bucket=os.environ["S3_BUCKET"], Prefix="")
for obj in resp.get("Contents", []):
print(obj["Key"])
```
## Gotchas
- **Use `s3a://` (the Hadoop driver), not `s3://` or `s3n://`.** The latter two are deprecated and may not be present in the cluster.
- **`aws-java-sdk-bundle` version drift** — pin to the version `hadoop-aws` was built against. Lab clusters often need this jar installed; the symptom of mismatch is `NoSuchMethodError` deep in `org.apache.hadoop.fs.s3a` when listing/reading.
- **`Configuration.setClassLoader` is required after runtime-load** — Hadoop's `FileSystem.get()` calls `Configuration.getClassByName()` which uses the Configuration's classloader (not the JVM thread context). Without `hconf.setClassLoader(ucl)`, you get `ClassNotFoundException: Class org.apache.hadoop.fs.s3a.S3AFileSystem not found` even though you just registered the jar.
- **Secrets in env vars only.** Never hard-code keys in notebooks. Source from `.env`/OCI Vault.
- **Region** — `boto3.client('s3', region_name=...)` is required for non-default regions; for the Spark path the bucket region is auto-discovered, but you may need `fs.s3a.endpoint=s3.<region>.amazonaws.com` for non-us-east-1 if listings fail.
- **`boto3` is NOT pre-installed on AIDP cluster** and PyPI mirror is typically unreachable. For management ops (list, copy, head), drive from local rather than cluster.
- **Egress cost & latency** — S3 reads from AIDP cross-cloud. For heavy ETL, copy to OCI Object Storage once and read locally.
## References
- Official sample: [oracle-samples/oracle-aidp-samples → `data-engineering/ingestion/Ingest_from_Multi_Cloud.ipynb`](https://github.com/oracle-samples/oracle-aidp-samples/blob/main/data-engineering/ingestion/Ingest_from_Multi_Cloud.ipynb)
- Hadoop AWS docs: <https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/>
## skills/aidp-azure-adls/SKILL.md
---
name: aidp-azure-adls
description: Read and write Azure Data Lake Storage Gen2 (`abfss://`) from an AIDP notebook. Use when the user mentions ADLS, Azure Data Lake, abfss, or wants to ingest from a multi-cloud Azure source. Auth is OAuth client-credentials (Service Principal client_id + secret + tenant).
allowed-tools: Read, Write, Edit, Bash
---
# `aidp-azure-adls` — Azure ADLS Gen2 via OAuth client-credentials
Read or write `abfss://<container>@<storage_account>.dfs.core.windows.net/...` paths from AIDP Spark using a Service Principal.
## When to use
- AIDP needs to consume or land data in Azure ADLS Gen2.
- Mentioned: "ADLS", "abfss", "Azure Data Lake".
## When NOT to use
- For OCI Object Storage → [`aidp-object-storage`](../aidp-object-storage/SKILL.md).
- For AWS S3 → [`aidp-aws-s3`](../aidp-aws-s3/SKILL.md).
## One-time auth setup
Configure the Spark Hadoop connector with Service-Principal credentials. Do this once per session/job:
```python
import os
storage_account = os.environ["ADLS_STORAGE_ACCOUNT"] # account name only, no .dfs...
client_id = os.environ["ADLS_CLIENT_ID"] # SP application (client) id
client_secret = os.environ["ADLS_CLIENT_SECRET"] # SP secret value
tenant = os.environ["ADLS_TENANT"] # Azure AD tenant id (GUID)
base = f"fs.azure.account"
host = f"{storage_account}.dfs.core.windows.net"
spark.conf.set(f"{base}.auth.type.{host}", "OAuth")
spark.conf.set(f"{base}.oauth.provider.type.{host}", "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set(f"{base}.oauth2.client.id.{host}", client_id)
spark.conf.set(f"{base}.oauth2.client.secret.{host}", client_secret)
spark.conf.set(f"{base}.oauth2.client.endpoint.{host}", f"https://login.microsoftonline.com/{tenant}/oauth2/token")
```
## Read
```python
container = os.environ["ADLS_CONTAINER"]
data_file = os.environ["ADLS_DATA_FILE"] # e.g. "data/2025/january/orders.csv"
df = (spark.read
.format("csv")
.option("header", True)
.load(f"abfss://{container}@{storage_account}.dfs.core.windows.net/{data_file}"))
df.show()
```
## Write (e.g. land into a managed Delta table)
```python
(df.write
.mode("overwrite")
.format("delta")
.saveAsTable("default.default.data_from_adls"))
```
## Gotchas
- **Service Principal must have RBAC on the storage account.** Assign `Storage Blob Data Contributor` (or Reader for read-only) on the container or the account.
- **Hierarchical Namespace must be enabled** on the storage account for `abfss://` to work (ADLS Gen2 = HNS-on storage account).
- **Secrets in env vars** — never hard-code in notebooks. Source from a `.env` file gitignored, or from OCI Vault via `oracle_ai_data_platform_connectors.auth.secrets.get(name)`.
- **Endpoint URL** — `login.microsoftonline.com/<tenant>/oauth2/token` is the v1 endpoint and is what the `ClientCredsTokenProvider` expects. Don't use the v2 endpoint here.
- **`abfss://` not `abfs://`** — always use the TLS variant.
## References
- Official sample: [oracle-samples/oracle-aidp-samples → `data-engineering/ingestion/Ingest_from_Multi_Cloud.ipynb`](https://github.com/oracle-samples/oracle-aidp-samples/blob/main/data-engineering/ingestion/Ingest_from_Multi_Cloud.ipynb)
- Hadoop Azure docs: <https://hadoop.apache.org/docs/stable/hadoop-azure/abfs.html>
## skills/aidp-azuresql/SKILL.md
---
name: aidp-azuresql
description: Read or write Azure SQL Database from an AIDP notebook through the AIDP `aidataplatform` Spark format handler. Use when the user mentions Azure SQL, Azure SQL Database, AZURE_SQLSERVER, or a database.windows.net endpoint. Auth is SQL username/password.
allowed-tools: Read, Write, Edit, Bash
---
# `aidp-azuresql` — Azure SQL Database via AIDP `aidataplatform`
Use the dedicated Azure SQL connector type, `AZURE_SQLSERVER`. It supports ingestion reads and writes, external-catalog access, `catalog.id`, and SQL pushdown.
## When to use
- Read or write Azure SQL Database from an AIDP notebook.
- Mentioned: "Azure SQL", "Azure SQL Database", or `database.windows.net`.
## When NOT to use
- For self-managed Microsoft SQL Server → [`aidp-sqlserver`](../aidp-sqlserver/SKILL.md).
- For Azure Data Lake Storage → [`aidp-azure-adls`](../aidp-azure-adls/SKILL.md).
## Ingestion read
```python
import os
from oracle_ai_data_platform_connectors.aidataplatform import (
AIDP_FORMAT, aidataplatform_options,
)
opts = aidataplatform_options(
type="AZURE_SQLSERVER",
host=os.environ["AZURE_SQL_HOST"],
port=int(os.environ.get("AZURE_SQL_PORT", "1433")),
database_name=os.environ["AZURE_SQL_DATABASE"],
user=os.environ["AZURE_SQL_USER"],
password=os.environ["AZURE_SQL_PASSWORD"],
schema=os.environ.get("AZURE_SQL_SCHEMA", "dbo"),
table=os.environ["AZURE_SQL_TABLE"],
)
df = spark.read.format(AIDP_FORMAT).options(**opts).load()
df.show(5)
```
## Ingestion write
`CREATE`, `APPEND`, `OVERWRITE`, and `MERGE` are supported. `write.merge.keys` is required for `MERGE`.
```python
write_opts = aidataplatform_options(
type="AZURE_SQLSERVER",
host=os.environ["AZURE_SQL_HOST"],
port=int(os.environ.get("AZURE_SQL_PORT", "1433")),
database_name=os.environ["AZURE_SQL_DATABASE"],
user=os.environ["AZURE_SQL_USER"],
password=os.environ["AZURE_SQL_PASSWORD"],
schema=os.environ.get("AZURE_SQL_SCHEMA", "dbo"),
table=os.environ["AZURE_SQL_TARGET_TABLE"],
extra={"write.mode": "CREATE"},
)
df.write.format(AIDP_FORMAT).options(**write_opts).save()
```
## External catalog and `catalog.id`
Create an Azure SQL external catalog in **Master Catalogs** first. Use a three-part name for catalog reads and writes, or `catalog.id` to reuse its saved connection.
```python
catalog_df = spark.table("<CATALOG_NAME>.<SCHEMA>.<TABLE_NAME>")
catalog_df.show(5)
catalog_id_df = (spark.read.format(AIDP_FORMAT)
.option("catalog.id", "<CATALOG_ID>")
.option("schema", "<SCHEMA>")
.option("table", "<TABLE_NAME>")
.load())
catalog_id_df.write.format(AIDP_FORMAT) \
.option("catalog.id", "<CATALOG_ID>") \
.option("schema", "<SCHEMA>") \
.option("table", "<TARGET_TABLE_NAME>") \
.option("write.mode", "APPEND") \
.save()
```
## Pushdown SQL
```python
pushdown_df = (spark.read.format(AIDP_FORMAT)
.options(**opts)
.option("pushdown.sql", "SELECT TOP 10 * FROM <SCHEMA>.<TABLE_NAME>")
.load())
pushdown_df.show(5)
```
## Gotchas
- Use `AZURE_SQLSERVER`, not `SQLSERVER`, for Azure SQL Database.
- Azure SQL normally uses port `1433`; pass the fully-qualified `*.database.windows.net` host.
- `schema` is usually `dbo`; `database.name` is the Azure SQL database.
- AIDP needs egress to the Azure SQL endpoint. Configure Azure firewall rules for the AIDP network path.
## References
- Official sample: [AzureSQL notebook](https://github.com/oracle-samples/oracle-aidp-samples/blob/main/data-engineering/ingestion/Read_Write_External_Ecosystem_Connectors/AzureSQL.ipynb)
## skills/aidp-connectors-bootstrap/SKILL.md
---
name: aidp-connectors-bootstrap
description: First-time setup. Use when the user wants to install/upload the AIDP Spark connectors helper package into their AIDP workspace, or has just installed this plugin and asks "how do I set it up", "first-time setup", "install the helpers", "bootstrap aidp connectors". Drives the AIDP MCP tools to push the helper package to /Workspace/Shared/ and runs a sanity import.
allowed-tools: Read, Bash
---
# `aidp-connectors-bootstrap` — first-time setup of the helper package in AIDP
## When to use
- The user just installed the plugin and asks "how do I set this up?", "what's the first step?", "install the helpers".
- The user runs a connector skill for the first time and gets `ModuleNotFoundError: No module named 'oracle_ai_data_platform_connectors'`.
- The user explicitly asks to upload the helper package to AIDP.
## Outcome of running this skill
- `/Workspace/Shared/oracle_ai_data_platform_connectors/scripts/oracle_ai_data_platform_connectors/` exists in the user's AIDP workspace, populated from the plugin's local `scripts/` directory.
- The user has run `examples/00_bootstrap_helpers.ipynb` once and it printed `BOOTSTRAP OK`.
- From that point on, every connector skill works without further setup.
## What the assistant should do
### Step 1 — locate the plugin's `scripts/` directory on disk
The plugin lives wherever the user installed it. Common locations:
- `~/.claude/plugins/<marketplace>/oracle-ai-data-platform-workbench-spark-connectors/scripts/oracle_ai_data_platform_connectors/`
- `~/.codex/plugins/<marketplace>/oracle-ai-data-platform-workbench-spark-connectors/scripts/oracle_ai_data_platform_connectors/`
- A local clone or repo checkout when developing.
Search the installed plugin cache and the local repo checkout for `scripts/oracle_ai_data_platform_connectors/`. Confirm the source and destination paths with the user before uploading.
### Step 2 — create the destination directory in AIDP
Use the AIDP MCP tools:
```
mcp__aidp__create_directory(
workspace_id="<user's workspace id>",
path="/Workspace/Shared/oracle_ai_data_platform_connectors"
)
mcp__aidp__create_directory(
workspace_id=...,
path="/Workspace/Shared/oracle_ai_data_platform_connectors/scripts"
)
```
(If the workspace_id isn't already known from the conversation, ask the user.)
### Step 3 — upload the package files
For each `.py` file under the local `scripts/oracle_ai_data_platform_connectors/`, upload to the matching path under `/Workspace/Shared/oracle_ai_data_platform_connectors/scripts/`. Use `mcp__aidp__upload_file` (or the equivalent in this MCP server).
The package layout to preserve:
```
oracle_ai_data_platform_connectors/
├── __init__.py
├── auth/{__init__,wallet,dbtoken,oci_config,user_principal,secrets}.py
├── jdbc/{__init__,oracle,hive}.py
├── rest/{__init__,fusion,epm,essbase}.py
└── streaming/{__init__,kafka}.py
```
### Step 4 — push the bootstrap notebook to AIDP and run it
Upload `examples/00_bootstrap_helpers.ipynb` to `Shared/connectors-tests/00_bootstrap_helpers.ipynb` via `mcp__aidp__nb_save_file`. Then `mcp__aidp__nb_create_session` against the user's chosen cluster (typically `tpcds`), and `mcp__aidp__nb_execute_code` for each cell. The final cell prints `BOOTSTRAP OK` if everything works.
### Step 5 — confirm
Tell the user:
- Where the helpers landed.
- That every connector skill in this plugin will now work.
- The next step is to pick a connector (e.g., `aidp-atp`) and supply that connector's env vars / Vault secrets.
## Alternative: ask the user to install via PyPI (v1.0+)
Once the package is published to PyPI, this skill should pivot to telling the user to run `%pip install oracle-ai-data-platform-connectors` in any AIDP cell instead of uploading. Until v1.0 ships, the Workspace-upload path above is the only way.
## What NOT to do
- Do not upload anything to `/Workspace/Shared/` without confirming the path with the user (in case they have an existing convention).
- Do not write secrets, .env contents, or PEM keys anywhere in `/Workspace/Shared/`. The helper package is code-only.
- Do not skip the sanity-import notebook — it's how you (and the user) confirm the upload worked, not just that files exist.
## References
- Bootstrap notebook: [`examples/00_bootstrap_helpers.ipynb`](../../examples/00_bootstrap_helpers.ipynb)
- Plugin README install section: [`README.md`](../../README.md)
## skills/aidp-connectors-overview/SKILL.md
---
name: aidp-connectors-overview
description: Help the user pick the right connector skill for their data source from an AIDP notebook. Use as a router when the user mentions multiple sources, isn't sure which connector applies, or asks "how do I connect to X from AIDP". Covers 26 data sources — Oracle Autonomous DB family (ALH/ADW/ATP), generic Oracle DB, ExaCS, PeopleSoft, Siebel, Fusion ERP/BICC, EPM Cloud, Essbase, OCI Streaming, Object Storage, Iceberg, plus PostgreSQL, MySQL/HeatWave, Db2, SQL Server, Azure SQL, Hive, Snowflake, Azure ADLS, AWS S3, Salesforce, NetSuite, generic REST, custom JDBC, Excel.
allowed-tools: Read
---
# `aidp-connectors-overview` — pick the right connector skill
## When to use
- The user is exploring options ("how do I connect to Oracle from AIDP?", "which connector should I use?").
- The user mentions multiple Oracle sources at once.
- The user describes a source by capability (e.g. "OLAP cube", "structured streaming") rather than naming the product directly.
## When NOT to use
- The user has already named their target product (ALH, ATP, Fusion, etc.) — invoke the matching `aidp-<product>` skill directly.
## How to route
**Before any connector skill works**, the helper package must be uploaded to the user's AIDP workspace. If the user hasn't done this yet (or you see `ModuleNotFoundError: oracle_ai_data_platform_connectors` in any prior cell), invoke [`aidp-connectors-bootstrap`](../aidp-connectors-bootstrap/SKILL.md) first. It uses the AIDP MCP tools to push the package into `/Workspace/Shared/` and runs a sanity-import notebook.
Otherwise, pick the right skill from this table and **invoke that skill**. Don't re-write its content here.
### Oracle / OCI sources
| User says... | Use skill |
|---|---|
| "ALH", "AI Lakehouse", "ADW", "ATP", "Autonomous Database", "26ai" | [`aidp-alh`](../aidp-alh/SKILL.md) — Autonomous DB family (wallet / IAM DB-Token / API key) |
| "Oracle Database", "generic Oracle DB", "on-prem Oracle", "Oracle 19c / 21c", "Base DB", "Oracle on Compute", non-Autonomous Oracle | [`aidp-oracle-db`](../aidp-oracle-db/SKILL.md) — generic Oracle DB via plain user/password on TCP 1521 |
| "ExaCS", "Exadata", "Exadata Cloud", "private-subnet Oracle DB" | [`aidp-exacs`](../aidp-exacs/SKILL.md) |
| "PeopleSoft", "PSFT", "PS HCM", "FSCM", "Campus Solutions" | [`aidp-peoplesoft`](../aidp-peoplesoft/SKILL.md) |
| "Siebel", "Siebel CRM", "S_CONTACT", "S_ORG_EXT" | [`aidp-siebel`](../aidp-siebel/SKILL.md) |
| "Fusion ERP", "Fusion HCM", "Fusion REST", "FA REST", "Cloud ERP API" | [`aidp-fusion-rest`](../aidp-fusion-rest/SKILL.md) |
| "BICC", "BI Cloud Connector", "Fusion bulk extract", >50k rows from Fusion | [`aidp-fusion-bicc`](../aidp-fusion-bicc/SKILL.md) |
| "EPM Cloud", "EPBCS", "Hyperion Planning", "Planning app", "exportdataslice" | [`aidp-epm-cloud`](../aidp-epm-cloud/SKILL.md) |
| "Essbase", "Essbase 21c", "MDX", "OLAP cube", "cube REST" | [`aidp-essbase`](../aidp-essbase/SKILL.md) |
| "OCI Streaming", "Kafka on OCI", "stream pool", "structured streaming Kafka" | [`aidp-streaming-kafka`](../aidp-streaming-kafk