### Setup Polaris and Load Data Script Source: https://docs.puppygraph.com/getting-started/querying-polaris-data-as-a-graph This bash script automates the setup of Polaris, including starting containers, creating an S3 bucket, provisioning a catalog, granting permissions, and loading sample Iceberg tables. ```bash #!/usr/bin/env bash set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) cd "$SCRIPT_DIR" docker compose up -d ROOT_TOKEN=( docker run --rm --network polaris_net alpine/curl:8.17.0 sh -lc ' apk add --no-cache jq >/dev/null curl -s --user root:s3cr3t \ -H "Polaris-Realm: POLARIS" \ -d grant_type=client_credentials \ -d scope=PRINCIPAL_ROLE:ALL \ http://polaris:8181/api/catalog/v1/oauth/tokens | jq -r .access_token ' ) docker run --rm --network polaris_net --entrypoint /bin/sh quay.io/minio/mc:RELEASE.2025-08-13T08-35-41Z -c ' mc alias set pol http://polaris-minio:9000 minio_root m1n1opwd >/dev/null && mc mb --ignore-existing pol/bucket457 ' docker run --rm --network polaris_net -e ROOT_TOKEN="$ROOT_TOKEN" alpine/curl:8.17.0 sh -lc ' apk add --no-cache jq >/dev/null if ! curl -s http://polaris:8181/api/management/v1/catalogs \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" | jq -e ".catalogs[]? | select(.name == \"modern_catalog\")" >/dev/null; then curl -s -X POST http://polaris:8181/api/management/v1/catalogs \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" \ -H "Content-Type: application/json" \ -d "{\"catalog\":{\"name\":\"modern_catalog\",\"type\":\"INTERNAL\",\"readOnly\":false,\"properties\":{\"default-base-location\":\"s3://bucket457/modern_catalog\"},\"storageConfigInfo\":{\"storageType\":\"S3\",\"allowedLocations\":[\"s3://bucket457/modern_catalog\",\"s3://bucket457\"],\"endpoint\":\"http://polaris-minio:9000\",\"endpointInternal\":\"http://polaris-minio:9000\",\"pathStyleAccess\":true}}" fi curl -s -X PUT http://polaris:8181/api/management/v1/catalogs/modern_catalog/catalog-roles/catalog_admin/grants \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" \ -H "Content-Type: application/json" \ -d "{\"type\":\"catalog\",\"privilege\":\"TABLE_WRITE_DATA\"}" curl -s -X PUT http://polaris:8181/api/management/v1/principal-roles/service_admin/catalog-roles/modern_catalog \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" \ -H "Content-Type: application/json" \ -d "{\"name\":\"catalog_admin\"}" ' docker compose exec -T -e ROOT_TOKEN="$ROOT_TOKEN" polaris-spark-iceberg bash -lc ' cat >/tmp/prepare.sql /opt/spark/bin/spark-sql \ --packages org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.10.1,org.apache.iceberg:iceberg-aws-bundle:1.10.1 \ --conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \ --conf spark.sql.catalog.polaris=org.apache.iceberg.spark.SparkCatalog \ --conf spark.sql.catalog.polaris.type=rest \ --conf spark.sql.catalog.polaris.uri=http://polaris:8181/api/catalog \ --conf spark.sql.catalog.polaris.oauth2-server-uri=http://polaris:8181/api/catalog/v1/oauth/tokens \ --conf spark.sql.catalog.polaris.header.X-Iceberg-Access-Delegation=vended-credentials \ --conf spark.sql.catalog.polaris.client.region=us-west-2 \ --conf spark.sql.catalog.polaris.token="${ROOT_TOKEN}" \ --conf spark.sql.catalog.polaris.warehouse=modern_catalog \ --conf spark.sql.defaultCatalog=polaris \ -f /tmp/prepare.sql ' <<'SQL' CREATE DATABASE IF NOT EXISTS modern; CREATE TABLE modern.person (id string, name string, age int) USING iceberg; INSERT INTO modern.person VALUES ('v1', 'marko', 29), ('v2', 'vadas', 27), ('v4', 'josh', 32), ('v6', 'peter', 35); CREATE TABLE modern.software (id string, name string, lang string) USING iceberg; INSERT INTO modern.software VALUES ('v3', 'lop', 'java'), ('v5', 'ripple', 'java'); CREATE TABLE modern.created (id string, from_id string, to_id string, weight double) USING iceberg; INSERT INTO modern.created VALUES ('e9', 'v1', 'v3', 0.4), ('e10', 'v4', 'v5', 1.0), ('e11', 'v4', 'v3', 0.4), ('e12', 'v6', 'v3', 0.2); CREATE TABLE modern.knows (id string, from_id string, to_id string, weight double) USING iceberg; INSERT INTO modern.knows VALUES ('e7', 'v1', 'v2', 0.5), ('e8', 'v1', 'v4', 1.0); SELECT COUNT(*) AS person_cnt FROM modern.person; SELECT COUNT(*) AS software_cnt FROM modern.software; SELECT COUNT(*) AS created_cnt FROM modern.created; SELECT COUNT(*) AS knows_cnt FROM modern.knows; SQL ``` -------------------------------- ### Setup Polaris and Load Iceberg Tables Source: https://docs.puppygraph.com/getting-started/querying-polaris-data-as-a-graph?q= This script automates the setup of Polaris, including starting Docker containers, creating an S3 bucket, provisioning a catalog, granting permissions, and loading sample Iceberg tables using Spark SQL. It requires Docker and basic shell utilities. ```bash #!/usr/bin/env bash set -euo pipefail SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) cd "$SCRIPT_DIR" docker compose up -d ROOT_TOKEN=( docker run --rm --network polaris_net alpine/curl:8.17.0 sh -lc ' apk add --no-cache jq >/dev/null curl -s --user root:s3cr3t \ -H "Polaris-Realm: POLARIS" \ -d grant_type=client_credentials \ -d scope=PRINCIPAL_ROLE:ALL \ http://polaris:8181/api/catalog/v1/oauth/tokens | jq -r .access_token ' ) docker run --rm --network polaris_net --entrypoint /bin/sh quay.io/minio/mc:RELEASE.2025-08-13T08-35-41Z -c ' mc alias set pol http://polaris-minio:9000 minio_root m1n1opwd >/dev/null && mc mb --ignore-existing pol/bucket457 ' docker run --rm --network polaris_net -e ROOT_TOKEN="$ROOT_TOKEN" alpine/curl:8.17.0 sh -lc ' apk add --no-cache jq >/dev/null if ! curl -s http://polaris:8181/api/management/v1/catalogs \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" | jq -e ".catalogs[]? | select(.name == \"modern_catalog\")" >/dev/null; then curl -s -X POST http://polaris:8181/api/management/v1/catalogs \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" \ -H "Content-Type: application/json" \ -d "{\"catalog\":{\"name\":\"modern_catalog\",\"type\":\"INTERNAL\",\"readOnly\":false,\"properties\":{\"default-base-location\":\"s3://bucket457/modern_catalog\"},\"storageConfigInfo\":{\"storageType\":\"S3\",\"allowedLocations\":[\"s3://bucket457/modern_catalog\",\"s3://bucket457\"],\"endpoint\":\"http://polaris-minio:9000\",\"endpointInternal\":\"http://polaris-minio:9000\",\"pathStyleAccess\":true}}"} fi curl -s -X PUT http://polaris:8181/api/management/v1/catalogs/modern_catalog/catalog-roles/catalog_admin/grants \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" \ -H "Content-Type: application/json" \ -d "{\"type\":\"catalog\",\"privilege\":\"TABLE_WRITE_DATA\"}" curl -s -X PUT http://polaris:8181/api/management/v1/principal-roles/service_admin/catalog-roles/modern_catalog \ -H "Authorization: Bearer ${ROOT_TOKEN}" \ -H "Polaris-Realm: POLARIS" \ -H "Content-Type: application/json" \ -d "{\"name\":\"catalog_admin\"}" ' docker compose exec -T -e ROOT_TOKEN="$ROOT_TOKEN" polaris-spark-iceberg bash -lc ' cat >/tmp/prepare.sql /opt/spark/bin/spark-sql \ --packages org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.10.1,org.apache.iceberg:iceberg-aws-bundle:1.10.1 \ --conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \ --conf spark.sql.catalog.polaris=org.apache.iceberg.spark.SparkCatalog \ --conf spark.sql.catalog.polaris.type=rest \ --conf spark.sql.catalog.polaris.uri=http://polaris:8181/api/catalog \ --conf spark.sql.catalog.polaris.oauth2-server-uri=http://polaris:8181/api/catalog/v1/oauth/tokens \ --conf spark.sql.catalog.polaris.header.X-Iceberg-Access-Delegation=vended-credentials \ --conf spark.sql.catalog.polaris.client.region=us-west-2 \ --conf spark.sql.catalog.polaris.token="${ROOT_TOKEN}" \ --conf spark.sql.catalog.polaris.warehouse=modern_catalog \ --conf spark.sql.defaultCatalog=polaris \ -f /tmp/prepare.sql ' <<'SQL' CREATE DATABASE IF NOT EXISTS modern; CREATE TABLE modern.person (id string, name string, age int) USING iceberg; INSERT INTO modern.person VALUES ('v1', 'marko', 29), ('v2', 'vadas', 27), ('v4', 'josh', 32), ('v6', 'peter', 35); CREATE TABLE modern.software (id string, name string, lang string) USING iceberg; INSERT INTO modern.software VALUES ('v3', 'lop', 'java'), ('v5', 'ripple', 'java'); CREATE TABLE modern.created (id string, from_id string, to_id string, weight double) USING iceberg; INSERT INTO modern.created VALUES ('e9', 'v1', 'v3', 0.4), ('e10', 'v4', 'v5', 1.0), ('e11', 'v4', 'v3', 0.4), ('e12', 'v6', 'v3', 0.2); CREATE TABLE modern.knows (id string, from_id string, to_id string, weight double) USING iceberg; INSERT INTO modern.knows VALUES ('e7', 'v1', 'v2', 0.5), ('e8', 'v1', 'v4', 1.0); SELECT COUNT(*) AS person_cnt FROM modern.person; SELECT COUNT(*) AS software_cnt FROM modern.software; SELECT COUNT(*) AS created_cnt FROM modern.created; SELECT COUNT(*) AS knows_cnt FROM modern.knows; SQL ``` -------------------------------- ### Install Neo4j Go Driver Source: https://docs.puppygraph.com/querying/querying-using-opencypher Install the Neo4j Go driver using the 'go get' command. This is necessary for Go applications to connect to PuppyGraph. ```bash go get "github.com/neo4j/neo4j-go-driver/v4/neo4j" ``` -------------------------------- ### Set Up Python Virtual Environment and Install PySpark Source: https://docs.puppygraph.com/getting-started/querying-biglake-data-as-a-graph?q= Create a Python virtual environment and activate it. Then, install the PySpark library, which is required for data preparation. ```bash python -m venv venv source venv/bin/activate pip install pyspark==4.0.1 ``` -------------------------------- ### Run PuppyGraph Docker Container Source: https://docs.puppygraph.com/getting-started/querying-alloydb-data-as-a-graph?q= Starts a PuppyGraph Docker container. Ensure Docker is installed and running. ```bash docker run -p 8081:8081 -p 8182:8182 -p 7687:7687 -e PUPPYGRAPH_PASSWORD=puppygraph123 -d --name puppy --rm --pull=always puppygraph/puppygraph:stable ``` -------------------------------- ### Run Polaris Setup Script Source: https://docs.puppygraph.com/getting-started/querying-polaris-data-as-a-graph?q= Execute the setup script to prepare Polaris and PuppyGraph. Ensure the script has execute permissions before running. ```bash chmod +x setup-polaris.sh ./setup-polaris.sh ``` -------------------------------- ### Start Unity Catalog Server Source: https://docs.puppygraph.com/getting-started/querying-unity-catalog-data-as-a-graph Start the Unity Catalog server on port 9000. This server will host your data for querying. ```bash ./bin/start-uc-server -p 9000 ``` -------------------------------- ### Start Gremlin Console Source: https://docs.puppygraph.com/connecting/connecting-to-apache-hive?q= Connect to the PuppyGraph Web GUI and start a gremlin console to begin querying. ```bash \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.utilities plugin activated: tinkerpop.tinkergraph Welcome to PuppyGraph! ... gremlin> ``` -------------------------------- ### Execute SQL Setup Script Source: https://docs.puppygraph.com/getting-started/querying-sql-server-data-as-a-graph?q= Connects to the SQL Server container using sqlcmd to execute the setup script, which creates the database, tables, and inserts initial data. ```bash docker exec -it sql-server /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P -C -i /setup.sql ``` -------------------------------- ### AWS Credentials File Example Source: https://docs.puppygraph.com/reference/cloud_integrations/aws/authentication?q= Example structure of the AWS credentials file used for authentication. Supports multiple profiles. ```ini [default] aws_access_key_id = AKIAIOSFODNN7EXAMPLE aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY [puppygraph] aws_access_key_id = AKIAI44QH8DHBEXAMPLE aws_secret_access_key = je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY ``` -------------------------------- ### Install Graph Notebook Packages Source: https://docs.puppygraph.com/querying/querying-using-opencypher?q= Install the necessary packages for Graph Notebook in a Python environment. Ensure you have Docker and uv installed. ```bash uv python install 3.11 uv venv --python 3.11 --seed uv pip install "jupyterlab>=4.3.5,<5" graph-notebook ``` -------------------------------- ### Run PuppyGraph Docker Container Source: https://docs.puppygraph.com/getting-started/querying-mongodb-atlas-data-as-a-graph Starts a PuppyGraph Docker container with specified ports and password. Ensure Docker is installed and running. ```bash docker run -p 8081:8081 -p 8182:8182 -p 7687:7687 -e "PUPPYGRAPH_PASSWORD=puppygraph123" -d --name puppy --rm --pull=always puppygraph/puppygraph:stable ``` -------------------------------- ### Start PuppyGraph with Access and Secret Key Source: https://docs.puppygraph.com/reference/cloud_integrations/aws/debug_with_cli Start PuppyGraph using environment variables for AWS access and secret keys. Ensure the AWS region is also specified. ```bash docker run -p 8081:8081 -p 8182:8182 -e AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE -e AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY -e AWS_REGION=us-east-1 --name puppy --rm -itd puppygraph/puppygraph:stable ``` -------------------------------- ### Install Graph Notebook Packages Source: https://docs.puppygraph.com/querying/querying-using-opencypher Install the necessary packages for Graph Notebook using the 'uv' package manager. Ensure Python 3.11 is available. ```bash uv python install 3.11 uv venv --python 3.11 --seed uv pip install "jupyterlab>=4.3.5,<5" graph-notebook ``` -------------------------------- ### SQL Script for Database and Table Setup Source: https://docs.puppygraph.com/getting-started/querying-sql-server-data-as-a-graph?q= Creates a new database 'DemoDB', a login 'demouser', and defines tables for persons, software, relationships (knows), and creations (created). ```sql CREATE DATABASE DemoDB; GO USE DemoDB; GO CREATE LOGIN demouser WITH PASSWORD = 'DemoPassword123'; GO CREATE USER demouser FOR LOGIN demouser; GO ALTER ROLE db_owner ADD MEMBER demouser; GO CREATE SCHEMA modern; GO CREATE TABLE modern.person ( id NVARCHAR(50), name NVARCHAR(50), age INT ); CREATE TABLE modern.software ( id NVARCHAR(50), name NVARCHAR(50), lang NVARCHAR(50) ); CREATE TABLE modern.knows ( id NVARCHAR(50), from_id NVARCHAR(50), to_id NVARCHAR(50), weight FLOAT ); CREATE TABLE modern.created ( id NVARCHAR(50), from_id NVARCHAR(50), to_id NVARCHAR(50), weight FLOAT ); GO INSERT INTO modern.person VALUES ('v1', 'marko', 29), ('v2', 'vadas', 27), ('v4', 'josh', 32), ('v6', 'peter', 35); INSERT INTO modern.software VALUES ('v3', 'lop', 'java'), ('v5', 'ripple', 'java'); INSERT INTO modern.knows VALUES ('e7', 'v1', 'v2', 0.5), ('e8', 'v1', 'v4', 1.0); INSERT INTO modern.created VALUES ('e9', 'v1', 'v3', 0.4), ('e10', 'v4', 'v5', 1.0), ('e11', 'v4', 'v3', 0.4), ('e12', 'v6', 'v3', 0.2); GO ``` -------------------------------- ### Start SparkSQL Instance for Hudi Data Preparation Source: https://docs.puppygraph.com/connecting/connecting-to-apache-hudi?q= Launches a SparkSQL instance with necessary Hudi packages and configurations for HDFS and Hive metastore. ```bash spark-sql --packages org.apache.hudi:hudi-spark3.3-bundle_2.12:0.13.0 \ --conf spark.hadoop.fs.defaultFS=hdfs://172.31.19.123:9000 \ --conf spark.sql.warehouse.dir=hdfs://172.31.19.123:9000/spark-warehouse \ --conf spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension \ --conf spark.serializer=org.apache.spark.serializer.KryoSerializer \ --conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.hudi.catalog.HoodieCatalog \ --conf spark.sql.catalog.spark_catalog.type=hive \ --conf spark.sql.catalog.puppy_hudi=org.apache.spark.sql.hudi.catalog.HoodieCatalog \ --conf spark.sql.catalog.puppy_hudi.type=hive \ --conf spark.sql.catalog.puppy_hudi.uri=thrift://172.31.31.125:9003 ``` -------------------------------- ### Create Project Directory Source: https://docs.puppygraph.com/getting-started/sni-tls-nginx Set up the necessary directory structure for the PuppyGraph and Nginx deployment. ```bash mkdir puppygraph-nginx-proxy cd puppygraph-nginx-proxy ``` -------------------------------- ### Start PuppyGraph CLI Source: https://docs.puppygraph.com/user-interface/puppygraph-cli Execute this command in your terminal to launch the PuppyGraph CLI within a Docker container. Ensure the 'puppy' container is running and has example graph data. ```bash docker exec -it puppy ./bin/puppygraph ``` -------------------------------- ### Override Specific Helm Chart Values Source: https://docs.puppygraph.com/installation/helm-chart Override specific values without editing `values.yaml` using `--set` flags during `helm upgrade --install`. This example sets replica counts for leader and compute pods. ```bash helm upgrade --install $RELEASE_NAME puppygraph/puppygraph \ -f values.yaml \ --set leader.replicas=3 \ --set compute.replicas=3 ``` -------------------------------- ### Clone Unity Catalog and Package Source: https://docs.puppygraph.com/getting-started/querying-unity-catalog-data-as-a-graph Clone the Unity Catalog repository and build the package. This prepares the necessary files to start the Unity Catalog server. ```bash git clone https://github.com/unitycatalog/unitycatalog cd unitycatalog build/sbt package ``` -------------------------------- ### Install Helm Package Manager Source: https://docs.puppygraph.com/installation/helm-chart Install Helm, a package manager for Kubernetes, using different methods based on your operating system. Verify the installation by checking the Helm version. ```bash # macOS (Homebrew) brew install helm ``` ```bash # Linux (via script) curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash ``` ```bash # Windows (Chocolatey) choco install kubernetes-helm ``` ```bash helm version ``` -------------------------------- ### Create Hive Tables for Demo Source: https://docs.puppygraph.com/connecting/connecting-to-apache-hive?q= Create the necessary Hive database and tables, then insert sample data. This step can be skipped if you have existing tables to query. ```sql CREATE DATABASE hive_onhdfs; CREATE TABLE hive_onhdfs.person (ID string, age int, name string); CREATE TABLE hive_onhdfs.referral (refId string, source string, referred string, weight double); INSERT INTO hive_onhdfs.person VALUES ('v1', 29, 'marko'), ('v2', 27, 'vadas'); INSERT INTO hive_onhdfs.referral VALUES ('e1', 'v1', 'v2', 0.5); ``` -------------------------------- ### Prepare Unity Catalog Data Source: https://docs.puppygraph.com/getting-started/querying-unity-catalog-data-as-a-graph Use the Unity Catalog CLI to create and populate tables for the 'puppygraph' catalog. This script sets up the 'person', 'knowns', 'software', and 'created' tables. ```bash #!/bin/bash uniti_dir=`pwd`/unitycatalog cli="${unity_dir}/bin/uc --server http://localhost:9000 " ${cli} catalog create --name puppygraph ${cli} schema create --name modern --catalog puppygraph ${cli} table create --full_name puppygraph.modern.person --columns "id STRING, name STRING, age INT" --storage_location file://${unity_dir}/etc/data/external/puppygraph/modern/person/ --format DELTA ${cli} table create --full_name puppygraph.modern.knowns --columns "id STRING, from_id STRING, to_id STRING, weight DOUBLE" --storage_location file://${unity_dir}/etc/data/external/puppygraph/modern/knowns/ --format DELTA ${cli} table create --full_name puppygraph.modern.software --columns "id STRING, name STRING, lang STRING" --storage_location file://${unity_dir}/etc/data/external/puppygraph/modern/software/ --format DELTA ${cli} table create --full_name puppygraph.modern.created --columns "id STRING, from_id STRING, to_id STRING, weight DOUBLE" --storage_location file://${unity_dir}/etc/data/external/puppygraph/modern/created/ --format DELTA ${cli} table write --full_name puppygraph.modern.person ${cli} table write --full_name puppygraph.modern.knowns ${cli} table write --full_name puppygraph.modern.software ${cli} table write --full_name puppygraph.modern.created ``` -------------------------------- ### Verify Docker Installation Source: https://docs.puppygraph.com/getting-started/launching-puppygraph-in-docker Run this command to check if Docker is installed on your system. ```bash docker version ``` -------------------------------- ### Install Gremlin Javascript Driver Source: https://docs.puppygraph.com/querying/querying-using-gremlin?q= Install the Gremlin JavaScript driver using npm. ```bash npm install gremlin ``` -------------------------------- ### Verify OpenSSL Installation Source: https://docs.puppygraph.com/getting-started/sni-tls-nginx Confirm that OpenSSL is installed, which is necessary for generating SSL certificates. ```bash openssl version ``` -------------------------------- ### Start SparkSQL for Hudi Data Preparation Source: https://docs.puppygraph.com/connecting/connecting-to-apache-hudi Launches a SparkSQL instance with necessary Hudi packages and configurations for HDFS and Hive Metastore. Ensure HDFS and Hive metastore URIs are correctly set for your environment. ```bash spark-sql --packages org.apache.hudi:hudi-spark3.3-bundle_2.12:0.13.0 \ --conf spark.hadoop.fs.defaultFS=hdfs://172.31.19.123:9000 \ --conf spark.sql.warehouse.dir=hdfs://172.31.19.123:9000/spark-warehouse \ --conf spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension \ --conf spark.serializer=org.apache.spark.serializer.KryoSerializer \ --conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.hudi.catalog.HoodieCatalog \ --conf spark.sql.catalog.spark_catalog.type=hive \ --conf spark.sql.catalog.puppy_hudi=org.apache.spark.sql.hudi.catalog.HoodieCatalog \ --conf spark.sql.catalog.puppy_hudi.type=hive \ --conf spark.sql.catalog.puppy_hudi.uri=thrift://172.31.31.125:9083 ``` -------------------------------- ### Verify Docker Compose Installation Source: https://docs.puppygraph.com/getting-started/modeling-a-graph-through-the-schema-builder Check if Docker Compose is installed and accessible on your system. ```bash docker compose version ``` -------------------------------- ### Install Neo4j JavaScript Driver Source: https://docs.puppygraph.com/querying/querying-using-opencypher Use npm to install the Neo4j JavaScript driver for your project. ```bash npm install neo4j-driver ``` -------------------------------- ### Gremlin Query Result Example Source: https://docs.puppygraph.com/connecting/connecting-to-apache-hive?q= Example output of a Gremlin query that retrieves names of people. ```gremlin gremlin> g.V().hasLabel("person").out("knows").values("name") ==>vadas ``` -------------------------------- ### Docker Compose Up Output Source: https://docs.puppygraph.com/getting-started/querying-nessie-and-minio-data-as-a-graph-with-tls?q= Example output indicating successful creation and startup of Docker networks and containers defined in the compose file. ```text [+] Running 5/5 ✔ Network iceberg_net Created ✔ Container nessie Started ✔ Container minio Started ✔ Container spark-iceberg Started ✔ Container puppygraph Started ``` -------------------------------- ### Example Readiness Probe Configuration Source: https://docs.puppygraph.com/installation/cluster-deployment Configure a readiness probe for leader nodes to ensure they are ready to communicate with the cluster on startup. This probe checks the /healthz path on port 8081. ```yaml readinessProbe: httpGet: path: /healthz port: 8081 initialDelaySeconds: 60 periodSeconds: 10 ``` -------------------------------- ### Install Gremlin Go Driver Source: https://docs.puppygraph.com/querying/querying-using-gremlin?q= Installs the official Gremlin Go driver for interacting with graph databases. ```bash go get "github.com/apache/tinkerpop/gremlin-go/v3/driver" ``` -------------------------------- ### Install Gremlin Python Driver Source: https://docs.puppygraph.com/querying/querying-using-gremlin?q= Installs the official Gremlin Python driver for interacting with graph databases. ```bash pip install gremlinpython ``` -------------------------------- ### Verify Docker Installation Source: https://docs.puppygraph.com/getting-started/querying-biglake-data-as-a-graph?q= Verify that Docker is installed on your system. This is a prerequisite for running the PuppyGraph Docker container. ```bash docker --version ``` -------------------------------- ### Start PuppyGraph Docker Container Source: https://docs.puppygraph.com/getting-started/querying-snowflake-data-as-a-graph Launches the PuppyGraph server in a Docker container, mapping necessary ports and mounting the private key file. Assumes `rsa_key.p8` is in the current directory. ```bash docker run -p 8081:8081 -p 8182:8182 -p 7687:7687 -e PUPPYGRAPH_PASSWORD=puppygraph123 -v ./rsa_key.p8:/home/rsa_key.p8 --name puppy --rm -itd puppygraph/puppygraph:stable ``` -------------------------------- ### Gremlin Query Result Example Source: https://docs.puppygraph.com/connecting/connecting-to-apache-hive Example output from a Gremlin query, showing the name 'vadas' as a result. ```gremlin gremlin> g.V().hasLabel("person").out("knows").values("name") ==>vadas ``` -------------------------------- ### Prepare Oracle Database Schema and Data Source: https://docs.puppygraph.com/getting-started/querying-oracle-data-as-a-graph This SQL script sets up a new user, grants necessary permissions, and creates tables (PERSON, SOFTWARE, CREATED, KNOWS) with sample data for graph representation. ```sql -- Switch to the PDB ALTER SESSION SET CONTAINER = ORCLPDB1; -- Create a new user and grant permissions CREATE USER MODERN IDENTIFIED BY modern_password; GRANT CONNECT, RESOURCE TO MODERN; ALTER USER MODERN QUOTA UNLIMITED ON USERS; ALTER USER MODERN DEFAULT TABLESPACE USERS; GRANT CREATE SESSION, CREATE TABLE, INSERT ANY TABLE TO MODERN; -- Switch to the MODERN schema ALTER SESSION SET CURRENT_SCHEMA = MODERN; -- Create the PERSON table and insert data CREATE TABLE PERSON ( ID VARCHAR2(255), NAME VARCHAR2(255), AGE NUMBER(10) ); -- Insert data into the PERSON table INSERT INTO PERSON (ID, NAME, AGE) VALUES ('v1', 'marko', 29); INSERT INTO PERSON (ID, NAME, AGE) VALUES ('v2', 'vadas', 27); INSERT INTO PERSON (ID, NAME, AGE) VALUES ('v4', 'josh', 32); INSERT INTO PERSON (ID, NAME, AGE) VALUES ('v6', 'peter', 35); -- Create the SOFTWARE table and insert data CREATE TABLE SOFTWARE ( ID VARCHAR2(255), NAME VARCHAR2(255), LANG VARCHAR2(255) ); -- Insert data into the SOFTWARE table INSERT INTO SOFTWARE (ID, NAME, LANG) VALUES ('v3', 'lop', 'java'); INSERT INTO SOFTWARE (ID, NAME, LANG) VALUES ('v5', 'ripple', 'java'); -- Create the CREATED table and insert data CREATE TABLE CREATED ( ID VARCHAR2(255), FROM_ID VARCHAR2(255), TO_ID VARCHAR2(255), WEIGHT FLOAT ); -- Insert data into the CREATED table INSERT INTO CREATED (ID, FROM_ID, TO_ID, WEIGHT) VALUES ('e9', 'v1', 'v3', 0.4); INSERT INTO CREATED (ID, FROM_ID, TO_ID, WEIGHT) VALUES ('e10', 'v4', 'v5', 1.0); INSERT INTO CREATED (ID, FROM_ID, TO_ID, WEIGHT) VALUES ('e11', 'v4', 'v3', 0.4); INSERT INTO CREATED (ID, FROM_ID, TO_ID, WEIGHT) VALUES ('e12', 'v6', 'v3', 0.2); -- Create the KNOWS table and insert data CREATE TABLE KNOWS ( ID VARCHAR2(255), FROM_ID VARCHAR2(255), TO_ID VARCHAR2(255), WEIGHT FLOAT ); -- Insert data into the KNOWS table INSERT INTO KNOWS (ID, FROM_ID, TO_ID, WEIGHT) VALUES ('e7', 'v1', 'v2', 0.5); INSERT INTO KNOWS (ID, FROM_ID, TO_ID, WEIGHT) VALUES ('e8', 'v1', 'v4', 1.0); ``` -------------------------------- ### Verify Docker and Docker Compose Installation Source: https://docs.puppygraph.com/getting-started/sni-tls-nginx Check if Docker and Docker Compose are installed on your system. These are required for the deployment. ```bash docker --version docker compose version ``` -------------------------------- ### Create and Populate 'software' Collection Source: https://docs.puppygraph.com/getting-started/querying-mongodb-bi-connector-data-as-a-graph Creates a 'software' collection with a schema validator and inserts sample software documents. The schema enforces 'id', 'name', and 'lang' fields. ```javascript db.createCollection("software", { validator: { $jsonSchema: { bsonType: "object", required: [ "id", "name", "lang" ], properties: { id: { bsonType: "string" }, name: { bsonType: "string" }, lang: { bsonType: "string" } } } } }) db.software.insertMany([ {id: 'v3', name: 'lop', lang: 'java'}, {id: 'v5', name: 'ripple', lang: 'java'} ]) ``` -------------------------------- ### Basic WCC Usage Source: https://docs.puppygraph.com/graph-algorithms/weakly-connected-components This example demonstrates the basic usage of the Weakly Connected Components algorithm using CypherGremlin and the graph.program API. ```APIDOC ## Basic WCC Usage ### CypherGremlin ```cyphergremlin CALL algo.wcc({ labels: ['User'], relationshipTypes: ['LINK'], maxIterations: 20 }) YIELD id, componentId RETURN id, componentId ``` ### graph.program API ```java graph.program( WeakConnectedComponentProgram.build() .maxIteration(20) .vertices("User") .edges("LINK") .create() ).submitAndGet().toList() ``` ``` -------------------------------- ### Install OpenSSL on Ubuntu Source: https://docs.puppygraph.com/getting-started/querying-nessie-and-minio-data-as-a-graph-with-tls?q= Install the OpenSSL package on Ubuntu systems. This is required for generating TLS certificates for secure communication. ```bash sudo apt update sudo apt install openssl ``` -------------------------------- ### Start the PuppyGraph CLI Source: https://docs.puppygraph.com/getting-started/querying-alloydb-data-as-a-graph?q= Connect to the PuppyGraph database using the Docker CLI to interact with the graph data via the Gremlin console. ```bash docker exec -it puppy ./bin/console ``` -------------------------------- ### Docker Compose Up Output Source: https://docs.puppygraph.com/getting-started/querying-mongodb-bi-connector-data-as-a-graph?q= Indicates the successful creation and startup of the network, MongoDB container, and PuppyGraph container. ```bash [+] Running 3/3 ✔ Network puppy-mongo Created 0.1s ✔ Container mongodb Started 3.7s ✔ Container puppygraph Started 3.7s ``` -------------------------------- ### Cypher Console Example Queries Source: https://docs.puppygraph.com/user-interface/puppygraph-cli In the Cypher Console, initiate queries with the ':>' prefix. This example demonstrates counting all nodes and returning all nodes. ```cypher puppy-cypher> :> MATCH (v) RETURN count(*) ==>[count(*):6] puppy-cypher> :> MATCH (v) RETURN v ==>[v:[_type:node,name:peter,_id:person[v6],_label:person,age:35]] ==>[v:[_type:node,name:marko,_id:person[v1],_label:person,age:29]] ==>[v:[_type:node,name:josh,_id:person[v4],_label:person,age:32]] ==>[v:[_type:node,name:vadas,_id:person[v2],_label:person,age:27]] ==>[v:[_type:node,name:ripple,_id:software[v5],lang:java,_label:software]] ==>[v:[_type:node,name:lop,_id:software[v3],lang:java,_label:software]] ``` -------------------------------- ### Local Cache Detail Response Example Source: https://docs.puppygraph.com/schema/local-cache An example response from the getLocalCacheDetail endpoint, illustrating the state of different views after a partial failure. ```json { "items": [ { "viewId": "node_label", "name": "node_label", "state": "OTHERS_UNAVAILABLE", "progress": "", "errorCode": "", "viewType": "VERTEX" }, { "viewId": "edge_label", "name": "edge_label", "state": "FAILED", "progress": "", "errorCode": "", "errorMessage": "", "viewType": "EDGE" } ], "status": "", "type": "" } ``` -------------------------------- ### StarRocks SQL for Data Preparation Source: https://docs.puppygraph.com/getting-started/querying-starrocks-data-as-a-graph SQL commands to create a database, tables (person, software, created, knows), and insert sample data. ```sql create database modern; use modern; create table person (id varchar(10), name varchar(50), age int); insert into person values ('v1', 'marko', 29), ('v2', 'vadas', 27), ('v4', 'josh', 32), ('v6', 'peter', 35); create table software (id varchar(10), name varchar(50), lang varchar(50)); insert into software values ('v3', 'lop', 'java'), ('v5', 'ripple', 'java'); create table created (id varchar(10), from_id varchar(10), to_id varchar(10), weight double); insert into created values ('e9', 'v1', 'v3', 0.4), ('e10', 'v4', 'v5', 1.0), ('e11', 'v4', 'v3', 0.4), ('e12', 'v6', 'v3', 0.2); create table knows (id varchar(10), from_id varchar(10), to_id varchar(10), weight double); insert into knows values ('e7', 'v1', 'v2', 0.5), ('e8', 'v1', 'v4', 1.0); ``` -------------------------------- ### Start PuppyGraph CLI Source: https://docs.puppygraph.com/getting-started/querying-clickhouse-data-as-a-graph Execute this command to launch the PuppyGraph command-line interface within your Docker environment. ```bash docker exec -it puppygraph ./bin/puppygraph ``` -------------------------------- ### Install Neo4j Python Driver Source: https://docs.puppygraph.com/querying/querying-using-opencypher Install the Neo4j Python driver using pip. This driver is required to interact with PuppyGraph from Python applications. ```bash pip install neo4j ``` -------------------------------- ### ClickHouse Data Preparation and Parameterized Views Source: https://docs.puppygraph.com/getting-started/querying-clickhouse-parameterized-views-as-a-graph?q= This script sets up the 'modern' database with person, software, created, and knows tables, then creates parameterized views in 'modern_view' for filtered querying. ```sql -- Drop databases if they exist DROP DATABASE IF EXISTS modern; DROP DATABASE IF EXISTS modern_view; -- Create primary database and its tables CREATE DATABASE IF NOT EXISTS modern; CREATE TABLE modern.person ( id String, name String, age Int32 ) ENGINE = MergeTree() ORDER BY id; INSERT INTO modern.person (id, name, age) VALUES ('v1','marko',29), ('v2','vadas',27), ('v4','josh',32), ('v6','peter',35); CREATE TABLE modern.software ( id String, name String, lang String ) ENGINE = MergeTree() ORDER BY id; INSERT INTO modern.software (id, name, lang) VALUES ('v3','lop','java'), ('v5','ripple','java'); CREATE TABLE modern.created ( id String, from_id String, to_id String, weight Float64 ) ENGINE = MergeTree() ORDER BY id; INSERT INTO modern.created (id, from_id, to_id, weight) VALUES ('e9','v1','v3',0.4), ('e10','v4','v5',1.0), ('e11','v4','v3',0.4), ('e12','v6','v3',0.2); CREATE TABLE modern.knows ( id String, from_id String, to_id String, weight Float64 ) ENGINE = MergeTree() ORDER BY id; INSERT INTO modern.knows (id, from_id, to_id, weight) VALUES ('e7','v1','v2',0.5), ('e8','v1','v4',1.0); /* 1) Create view database */ CREATE DATABASE IF NOT EXISTS modern_view; /* 2) Parameterized view for `person` */ CREATE OR REPLACE VIEW modern_view.person AS SELECT id, name, age FROM modern.person WHERE ({id:String} = '' OR id = {id:String}) AND ({name:String} = '' OR name = {name:String}) AND (age >= {min_age:Int32}) AND (age <= {max_age:Int32}); /* 3) Parameterized view for `software` */ CREATE OR REPLACE VIEW modern_view.software AS SELECT id, name, lang FROM modern.software WHERE ({lang:String} = '' OR lang = {lang:String}) AND ({name:String} = '' OR name = {name:String}); /* 4) Parameterized view for `created` */ CREATE OR REPLACE VIEW modern_view.created AS SELECT id, from_id, to_id, weight FROM modern.created WHERE ({from_id:String} = '' OR from_id = {from_id:String}) AND ({to_id:String} = '' OR to_id = {to_id:String}) AND (weight >= {min_w:Float64}) AND (weight <= {max_w:Float64}); /* 5) Parameterized view for `knows` */ CREATE OR REPLACE VIEW modern_view.knows AS SELECT id, from_id, to_id, weight FROM modern.knows WHERE ({from_id:String} = '' OR from_id = {from_id:String}) AND ({to_id:String} = '' OR to_id = {to_id:String}) AND (weight >= {min_w:Float64}) AND (weight <= {max_w:Float64}); ```