aidp-snowflake
Read or write Snowflake from an AIDP notebook via Spark using the Snowflake Spark connector. Use when the user mentions Snowflake, Snowflake warehouse, sfUrl, sfUser, or wants to migrate from Snowflake. Auth is sfUser + sfPassword over the Snowflake Spark connector (`net.snowflake.spark.snowflake`).
What this skill does
# `aidp-snowflake` — Snowflake via the Snowflake Spark connector
Bridge AIDP Spark to Snowflake using the official Snowflake Spark connector. Useful for migration off Snowflake or for cross-warehouse joins where Snowflake holds the source of truth.
## When to use
- Reading or writing a Snowflake warehouse from AIDP.
- Mentioned: "Snowflake", "sfUrl", "sfWarehouse".
## When NOT to use
- For a generic JDBC-only DB (no Spark connector available) → [`aidp-jdbc-custom`](../aidp-jdbc-custom/SKILL.md).
## Cluster prerequisite — install the connector JARs
The Snowflake Spark connector is **not** in the AIDP cluster image by default. Two ways to get it in.
### Option A — Runtime-load (recommended; no cluster restart)
The plugin's `add_spark_connector_at_runtime` helper downloads + registers both JARs in the running Spark session.
```python
from oracle_ai_data_platform_connectors.jdbc import (
add_spark_connector_at_runtime, download_jdbc_jar,
)
jars = [
download_jdbc_jar(
maven_url="https://repo1.maven.org/maven2/net/snowflake/"
"spark-snowflake_2.12/3.1.1/spark-snowflake_2.12-3.1.1.jar",
target_path="/tmp/spark-snowflake_2.12-3.1.1.jar"),
download_jdbc_jar(
maven_url="https://repo1.maven.org/maven2/net/snowflake/"
"snowflake-jdbc/3.19.0/snowflake-jdbc-3.19.0.jar",
target_path="/tmp/snowflake-jdbc-3.19.0.jar"),
]
add_spark_connector_at_runtime(
spark,
jar_paths=jars,
verify_classes=[
"net.snowflake.spark.snowflake.DefaultSource",
"net.snowflake.client.jdbc.SnowflakeDriver",
],
register_jdbc_driver_class="net.snowflake.client.jdbc.SnowflakeDriver",
)
```
The helper does three things in one call: builds a `URLClassLoader` covering both JARs and sets it as the thread context CL (so Spark's `ServiceLoader` finds the `snowflake` format), registers the JDBC driver with `DriverManager` (for any code path that goes through `getConnection`), and calls `SparkContext.addJar` on each JAR (so executors fetch them — required because Snowflake reads partition across executors). All without a kernel restart.
### Option B — Cluster Library tab (durable, requires admin)
Upload both JARs to a Volume and attach via the cluster Library tab. Persists across cluster restarts. Requires admin access. After restart, skip the runtime-load helper.
Pin the versions — newer Snowflake connector / JDBC may not be compatible with the cluster's Spark version. The pair tested on Spark 3.5.0 / Scala 2.12 is `spark-snowflake_2.12-3.1.1` + `snowflake-jdbc-3.19.0`.
## Read
```python
import os
snowflake_options = {
"sfUrl": os.environ["SNOW_URL"], # e.g. xy12345.us-east-1.snowflakecomputing.com
"sfUser": os.environ["SNOW_USER"],
"sfPassword": os.environ["SNOW_PASSWORD"],
"sfDatabase": os.environ.get("SNOW_DATABASE", "DATAFLOW"),
"sfSchema": os.environ.get("SNOW_SCHEMA", "DF_SCHEMA"),
"sfWarehouse": os.environ.get("SNOW_WAREHOUSE", "COMPUTE_WH"),
}
df = (spark.read
.format("snowflake")
.options(**snowflake_options)
.option("dbtable", os.environ["SNOW_TABLE"])
.load())
df.show(5)
```
## Write
```python
(df.write
.format("snowflake")
.options(**snowflake_options)
.option("dbtable", os.environ["SNOW_TARGET_TABLE"])
.mode("overwrite")
.save())
```
## Gotchas
- **No Spark JDBC fallback in this skill.** The Snowflake JDBC alone (no Spark connector) doesn't push down predicates and is much slower. Use the Spark connector.
- **Network reachability** — Snowflake is public over TLS; the AIDP cluster needs egress. If your cluster is in a strict NSG, allow outbound HTTPS to `*.snowflakecomputing.com`.
- **Auth** — only password auth shown here. Snowflake key-pair auth (RSA) and OAuth are also supported by the connector but require additional `pem_private_key` / `sfAuthenticator` options not covered in this skill.
- **`dbtable` is the simplest spec.** For complex pushdown use `query` instead — `option("query", "SELECT ... FROM ... WHERE ...")` runs the query in Snowflake and only ships the result.
- **Case sensitivity** — Snowflake folds unquoted names to UPPERCASE. If a Spark write fails with "table not found" on a lowercase target, quote the name in `dbtable`.
## References
- Official sample: [oracle-samples/oracle-aidp-samples → `data-engineering/ingestion/Connect_Using_Custom_JDBC_Driver.ipynb`](https://github.com/oracle-samples/oracle-aidp-samples/blob/main/data-engineering/ingestion/Connect_Using_Custom_JDBC_Driver.ipynb)
- Snowflake Spark connector docs: <https://docs.snowflake.com/en/user-guide/spark-connector>
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.