Skip to main content

aidp-hive

Read or write Apache Hive from an AIDP notebook via the AIDP `aidataplatform` Spark format handler. Use when the user mentions Hive, HiveServer2, HS2, HCatalog, or has a Hive metastore host/port. Auth is host/port + user/password. Read-write.

설치로 이동

소스 정보

저장소
oracle-samples/oracle-aidp-samples
최근 소스 활동
2026년 6월 26일 15:45
감지된 SKILL.md 언어
영어
스타
47
포크
32

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
aidp-hive
description
Read or write Apache Hive from an AIDP notebook via the AIDP `aidataplatform` Spark format handler. Use when the user mentions Hive, HiveServer2, HS2, HCatalog, or has a Hive metastore host/port. Auth is host/port + user/password. Read-write.
allowed-tools
Read, Write, Edit, Bash
# `aidp-hive` — Apache Hive via AIDP `aidataplatform` ## When to use - User wants to read or write a Hive table from an AIDP notebook. - User mentions: "Hive", "HiveServer2", "HS2", "HCatalog", "Hive metastore", a Hive database/table name. ## When NOT to use - For Oracle Big Data Service (BDS) HiveServer2 with **Kerberos** auth via Spark JDBC → use a custom skill (we removed `aidp-bds-hive` from v0.4 scope; revisit if your customer needs Kerberos specifically). The current `aidp-hive` skill covers non-Kerberos Hive (LDAP / SASL-PLAIN / NoAuth) via the `aidataplatform` format handler. - For Iceberg-on-Hive-style metadata where data lives on `oci://` → [`aidp-iceberg`](../aidp-iceberg/SKILL.md). ## Prerequisites in the AIDP notebook 1. Helpers on `sys.path` (run `aidp-connectors-bootstrap` first). 2. Network: cluster must reach the HS2 host on the configured port (typically 10000). If your Hive lives in a customer VCN, ensure VCN peering is in place — the cluster pod CIDR has no implicit route to user VCNs. 3. Env vars / OCI Vault secrets: - `HIVE_HOST` (HiveServer2 hostname) - `HIVE_PORT` (typically `10000`) - `HIVE_USER`, `HIVE_PASSWORD` - `HIVE_SCHEMA` (Hive database name) - `HIVE_TABLE` (Hive table name) ## Read ```python import os from oracle_ai_data_platform_connectors.aidataplatform import ( AIDP_FORMAT, aidataplatform_options, ) opts = aidataplatform_options( type="HIVE", host=os.environ["HIVE_HOST"], port=int(os.environ.get("HIVE_PORT", "10000")), user=os.environ["HIVE_USER"], password=os.environ["HIVE_PASSWORD"], schema=os.environ["HIVE_SCHEMA"], table=os.environ["HIVE_TABLE"], ) df = spark.read.format(AIDP_FORMAT).options(**opts).load() df.show(10) ``` ## Write ```python opts = aidataplatform_options( type="HIVE", host=os.environ["HIVE_HOST"], port=int(os.environ.get("HIVE_PORT", "10000")), user=os.environ["HIVE_USER"], password=os.environ["HIVE_PASSWORD"], schema=os.environ["HIVE_SCHEMA"], table=os.environ["HIVE_TARGET_TABLE"], extra={"write.mode": "APPEND"}, # CREATE | APPEND | OVERWRITE ) df.write.format(AIDP_FORMAT).options(**opts).save() ``` ## Pushdown SQL ```python opts = aidataplatform_options( type="HIVE", host=os.environ["HIVE_HOST"], port=int(os.environ.get("HIVE_PORT", "10000")), user=os.environ["HIVE_USER"], password=os.environ["HIVE_PASSWORD"], extra={ "pushdown.sql": ( "SELECT customer_id, SUM(amount) AS total " "FROM sales_db.transactions " "WHERE event_dt >= '2025-01-01' " "GROUP BY customer_id" ), }, ) df = spark.read.format(AIDP_FORMAT).options(**opts).load() df.show(10) ``` ## Gotchas - **No `database.name` option** — Hive uses `schema` directly to identify the Hive database (e.g. `default`, `sales_db`). Don't pass `database_name`. - **Network reachability is the most common failure.** Smoke-test from the cluster: `socket.create_connection((host, port), timeout=8)`. If this fails, it's a network problem, not an auth problem — VCN peering / NSG / DNS, in that order. - **No Kerberos on this skill.** This connector handler uses LDAP / SASL-PLAIN / NoAuth. If your Hive cluster only accepts Kerberos, you need a Spark-native JDBC path with a keytab (out of scope for v0.5 — file an issue). - **Write modes** — `CREATE` (fail if exists), `APPEND`, `OVERWRITE`. Default is `CREATE`. - **Partitioned tables.** When writing to a partitioned Hive table, `OVERWRITE` overwrites all partitions touched by the DataFrame's distinct partition keys; existing partitions not touched are preserved. ## References - Helper: [scripts/oracle_ai_data_platform_connectors/aidataplatform.py](../../scripts/oracle_ai_data_platform_connectors/aidataplatform.py) - Official sample: [oracle-samples/oracle-aidp-samples → `data-engineering/ingestion/Read_Write_External_Ecosystem_Connectors/Hive.ipynb`](https://github.com/oracle-samples/oracle-aidp-samples/blob/main/data-engineering/ingestion/Read_Write_External_Ecosystem_Connectors/Hive.ipynb)
GitHub에서 보기