/oracle-ai-data-platform-workbench-spark-connectors:aidp-postgresqlfrom oracle-ai-data-platform-workbench-spark-connectors
Reads or writes PostgreSQL from an AIDP notebook using the AIDP `aidataplatform` Spark format handler. Includes pushdown SQL and native Spark JDBC fallback for SSL-required endpoints.
Ships in oracle-ai-data-platform-workbench-spark-connectors. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
aidp-postgresql — PostgreSQL via AIDP aidataplatformaidp-mysql.aidp-sqlserver.aidp-jdbc-custom.aidataplatform format (default)Use the official AIDP PostgreSQL connector sample first.
import os
from oracle_ai_data_platform_connectors.aidataplatform import (
AIDP_FORMAT, aidataplatform_options,
)
opts = aidataplatform_options(
type="POSTGRESQL",
host=os.environ["PG_HOST"],
port=int(os.environ.get("PG_PORT", "5432")),
user=os.environ["PG_USER"],
password=os.environ["PG_PASSWORD"],
schema=os.environ.get("PG_SCHEMA", "public"),
table=os.environ["PG_TABLE"],
)
df = spark.read.format(AIDP_FORMAT).options(**opts).load()
df.show()
opts = aidataplatform_options(
type="POSTGRESQL",
host=os.environ["PG_HOST"],
port=int(os.environ.get("PG_PORT", "5432")),
user=os.environ["PG_USER"],
password=os.environ["PG_PASSWORD"],
schema=os.environ.get("PG_SCHEMA", "public"),
table=os.environ["PG_TARGET_TABLE"],
extra={"write.mode": "CREATE"}, # CREATE | APPEND | OVERWRITE
)
df.write.format(AIDP_FORMAT).options(**opts).save()
opts = aidataplatform_options(
type="POSTGRESQL",
host=os.environ["PG_HOST"],
port=int(os.environ.get("PG_PORT", "5432")),
user=os.environ["PG_USER"],
password=os.environ["PG_PASSWORD"],
extra={
"pushdown.sql": (
f"SELECT * FROM {os.environ.get('PG_SCHEMA', 'public')}.{os.environ['PG_TABLE']} "
"WHERE updated_at >= DATE '2024-01-01'"
),
},
)
df = spark.read.format(AIDP_FORMAT).options(**opts).load()
df.show()
Use this only when the target PostgreSQL service rejects non-TLS connections and the AIDP connector cannot pass the required SSL option. The observed failure mode is [PostgreSQL]connection is insecure (try using sslmode=require). In that case, use Spark native JDBC with URL-embedded sslmode=require.
The cluster may not have org.postgresql.Driver pre-installed, so runtime-load it the same way aidp-jdbc-custom does.
import hashlib, os, urllib.request
from py4j.java_gateway import java_import
JAR_PATH = "/tmp/postgresql-42.7.4.jar"
JAR_SHA256 = "188976721ead8e8627eb6d8389d500dccc0c9bebd885268a3047180274a6031e" # re-pin when changing the version
if not os.path.exists(JAR_PATH):
urllib.request.urlretrieve(
"https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.4/postgresql-42.7.4.jar",
JAR_PATH,
)
if hashlib.sha256(open(JAR_PATH, "rb").read()).hexdigest() != JAR_SHA256:
os.remove(JAR_PATH)
raise RuntimeError("postgresql jar checksum mismatch")
# Register driver on driver JVM
gw = spark._sc._gateway
url = spark._jvm.java.io.File(JAR_PATH).toURI().toURL()
arr = gw.new_array(spark._jvm.java.net.URL, 1); arr[0] = url
ucl = spark._jvm.java.net.URLClassLoader(arr, spark._jvm.java.lang.ClassLoader.getSystemClassLoader())
spark._jvm.java.lang.Thread.currentThread().setContextClassLoader(ucl)
DriverCls = spark._jvm.java.lang.Class.forName("org.postgresql.Driver", True, ucl)
spark._jvm.java.sql.DriverManager.registerDriver(DriverCls.newInstance())
spark._jsc.addJar(JAR_PATH) # distribute to executors
# Now read — note sslmode=require URL-embedded
JDBC_URL = (
f"jdbc:postgresql://{os.environ['PG_HOST']}:{os.environ.get('PG_PORT','5432')}"
f"/{os.environ['PG_DB']}?sslmode=require"
)
df = (spark.read.format("jdbc")
.option("url", JDBC_URL)
.option("driver", "org.postgresql.Driver")
.option("user", os.environ["PG_USER"])
.option("password", os.environ["PG_PASSWORD"])
.option("dbtable", f"{os.environ.get('PG_SCHEMA','public')}.{os.environ['PG_TABLE']}")
.load())
df.show(5)
aidataplatform first. It is the official sample path and has its own bundled driver.POSTGRESQL handler cannot pass SSL options and the server requires sslmode=require, use Option B with native Spark JDBC. Verified live 2026-04-27 against Neon serverless 17.8.URLClassLoader + DriverManager.registerDriver + spark._jsc.addJar.socket.create_connection((host, 5432), timeout=8).schema is the Postgres logical schema (e.g. public), not the database name. The database name is a separate PG_DB env var that goes into the JDBC URL.CREATE (fail if exists), APPEND, OVERWRITE. Default is CREATE.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
None: SKILL.md is the whole skill.
29 skills in this plugin
/aidp-alhConnect 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./aidp-aws-s3Read 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)./aidp-azure-adlsRead 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)./aidp-azuresqlRead 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./aidp-connectors-bootstrapFirst-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./aidp-connectors-overviewHelp 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 27 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, Google BigQuery, Azure ADLS, AWS S3, Salesforce, NetSuite, generic REST, custom JDBC, Excel.Generated from the plugin's indexed repository (oracle-samples/oracle-aidp-samples) — no native marketplace selected
npx claudepluginhub p/oracle-samples-oracle-ai-data-platform-workbench-spark-connectors-ai-claude-code-plugins-oracle-ai-data-platform-workbench-spark-connectorsOther plugins' skills for the same job