### Dockerized Installer Tests Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/CLAUDE.md This section outlines how to build and run tests for the installer script using Docker. Tests cover various scenarios including fresh installs, idempotent runs, updates, and agent-specific installations. Mocks for CLIs like claude, curl, npx, and exapump are used within the Docker environment. ```bash # Build the installer test image docker build -f Dockerfile.test -t installer-test . # Run specific test scenarios docker run --rm -e SCENARIO=fresh installer-test sh test/test-installer.sh docker run --rm -e SCENARIO=idempotent installer-test sh test/test-installer.sh docker run --rm -e SCENARIO=update installer-test sh test/test-installer.sh docker run --rm -e SCENARIO=fresh-claude installer-test sh test/test-installer.sh docker run --rm -e SCENARIO=fresh-codex installer-test sh test/test-installer.sh ``` -------------------------------- ### Install exasol-agent-skills CLI Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exapump-reference.md Installs the exasol-agent-skills CLI using a curl command to download and execute an installation script. This is a one-time setup process. ```bash curl -fsSL https://raw.githubusercontent.com/exasol-labs/exapump/main/install.sh | sh ``` -------------------------------- ### Start Interactive Exasol REPL with exasol-agent-skills CLI Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exapump-reference.md Starts an interactive SQL Read-Eval-Print Loop (REPL) session connected to Exasol. Allows for executing multiple SQL commands sequentially in an interactive environment. ```bash exapump interactive [OPTIONS] # Example: exapump interactive --profile production ``` -------------------------------- ### Install exasol-script-languages-container-tool Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Installs the exasol-script-languages-container-tool using pip. This is a prerequisite for using the exaslct commands. ```bash pip install exasol-script-languages-container-tool ``` -------------------------------- ### Manual Installation for Claude Code Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/README.md Manually installs Exasol Agent Skills for Claude Code using the 'claude plugin' command. This involves adding the marketplace and then installing the specific exasol skill. ```bash claude plugin marketplace add exasol-labs/exasol-agent-skills claude plugin install exasol@exasol-skills ``` -------------------------------- ### Start Interactive SQL REPL (Exasol) Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt Launch an interactive SQL command-line interface for executing ad-hoc queries and exploring the Exasol database. Supports using a specific profile for connection. ```bash # Start interactive session with default profile exapump interactive # Start with specific profile exapump interactive --profile production ``` -------------------------------- ### Install udf-mock-python Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-python.md Installs the exasol-udf-mock-python library using pip. This is a prerequisite for using the library to test UDFs. ```bash pip install exasol-udf-mock-python ``` -------------------------------- ### Install Exasol Agent Skills Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt Installs the Exasol Agent Skills plugin for AI coding agents. Supports interactive installation or specific agent targeting (Claude Code, OpenAI Codex). ```bash # Interactive install - prompts for agent selection curl -fsSL https://raw.githubusercontent.com/exasol-labs/exasol-agent-skills/main/install.sh | sh # Install for Claude Code only export AGENT=claude curl -fsSL https://raw.githubusercontent.com/exasol-labs/exasol-agent-skills/main/install.sh | sh # Install for OpenAI Codex only export AGENT=codex curl -fsSL https://raw.githubusercontent.com/exasol-labs/exasol-agent-skills/main/install.sh | sh # Manual install for Claude Code claude plugin marketplace add exasol-labs/exasol-agent-skills claude plugin install exasol@exasol-skills # Manual install for OpenAI Codex npx skills add exasol-labs/exasol-agent-skills --agent codex ``` -------------------------------- ### Verify Package Installation with a Python UDF Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Creates and executes a simple Python scalar UDF to verify the installation and versions of common data science packages like scikit-learn, pandas, and NumPy within the Exasol environment. ```sql CREATE OR REPLACE PYTHON3 SCALAR SCRIPT test_packages() RETURNS VARCHAR(2000) AS import sklearn, pandas, numpy def run(ctx): return f"sklearn={sklearn.__version__}, pandas={pandas.__version__}, numpy={numpy.__version__}" / SELECT test_packages(); ``` -------------------------------- ### Custom Dockerfile Commands Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Shows how to add custom commands to the SLC Dockerfile, such as installing packages from Git or system libraries. Highlights restrictions on commands like `FROM` and environment variables. ```dockerfile # Install from git RUN pip install git+https://github.com/some/package.git@v1.0.0 # Install system libraries needed by Python packages RUN apt-get update && \ apt-get install -y --no-install-recommends libpq-dev && \ rm -rf /var/lib/apt/lists/* ``` -------------------------------- ### Exasol Slash Command Examples (Claude Code) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/README.md Demonstrates how to use the /exasol slash command in Claude Code for interacting with Exasol. This includes running SQL queries, uploading data, and exporting data. ```bash /exasol SELECT * FROM my_table ``` ```bash /exasol upload sales.csv to analytics.sales ``` ```bash /exasol export users to parquet ``` -------------------------------- ### Exapump Interactive API Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exapump-reference.md Start an interactive SQL REPL session connected to Exasol. ```APIDOC ## POST /exapump/interactive ### Description Start an interactive SQL REPL session connected to Exasol. ### Method POST ### Endpoint /exapump/interactive ### Parameters #### Path Parameters None #### Query Parameters - **--profile** (string) - Optional - Use a saved connection profile instead of the default #### Request Body None ### Request Example ```json { "command": "exapump interactive --profile production" } ``` ### Response #### Success Response (200) - **message** (string) - Indicates the interactive session has started. #### Response Example ```json { "message": "Starting interactive Exasol session..." } ``` ``` -------------------------------- ### Java SET Script Example Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Example of a Java SET script that calculates the median of a list of double values. ```APIDOC ## CREATE OR REPLACE JAVA SET SCRIPT my_schema.median_calc ### Description Calculates the median value from a set of input double values. ### Method CREATE OR REPLACE JAVA SET SCRIPT ### Endpoint N/A (SQL Script) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Input is defined in the SQL script signature) ### Request Example ```sql CREATE OR REPLACE JAVA SET SCRIPT my_schema.median_calc(val DOUBLE) EMITS (median_value DOUBLE) AS import java.util.ArrayList; import java.util.Collections; class MEDIAN_CALC { static void run(ExaMetadata exa, ExaIterator ctx) throws Exception { ArrayList values = new ArrayList<>(); do { Double v = ctx.getDouble("val"); if (v != null) values.add(v); } while (ctx.next()); Collections.sort(values); int n = values.size(); double median = (n % 2 == 0) ? (values.get(n/2 - 1) + values.get(n/2)) / 2.0 : values.get(n/2); ctx.emit(median); } } / ``` ### Response #### Success Response (200) Emits a single row with the calculated median value. #### Response Example ```json { "median_value": 15.5 } ``` ``` -------------------------------- ### Querying Exasol Reserved Keywords Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exasol-sql.md Provides SQL examples for checking the reservation status of a specific keyword and retrieving a list of all reserved keywords from the `EXA_SQL_KEYWORDS` system table. ```sql -- Check if a word is reserved SELECT * FROM EXA_SQL_KEYWORDS WHERE KEYWORD = 'PROFILE'; -- Get all reserved keywords SELECT KEYWORD FROM EXA_SQL_KEYWORDS WHERE RESERVED; ``` -------------------------------- ### SQL Window Function Syntax and Frame Clauses Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/analytics-qualify.md Demonstrates the general syntax for SQL window functions, including PARTITION BY, ORDER BY, and frame clauses. It outlines the difference between ROWS and RANGE frame types and provides examples of common frame clause definitions. ```sql SELECT () OVER ( [PARTITION BY , ...] [ORDER BY [ASC|DESC], ...] [] ) ``` ```sql -- Default when ORDER BY is present: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING RANGE BETWEEN INTERVAL '7' DAY PRECEDING AND CURRENT ROW ``` -------------------------------- ### Local Development Commands for Exasol Agent Skills Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/CLAUDE.md Provides commands for local development, including adding the skills marketplace, installing the Exasol plugin, and updating skills. Updates require specifying the scope, typically 'user'. ```bash # Add the local skills marketplace claude plugin marketplace add ./path/to/exasol-agent-skills # Install the Exasol plugin claude plugin install exasol@exasol-skills # Update the Exasol plugin after changing skill/reference files claude plugin update exasol --scope user ``` -------------------------------- ### Installer Script for Exasol Agent Skills Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/CLAUDE.md The install.sh script is a POSIX-compliant shell script designed for idempotent installation and updating of Exasol agent skills. It supports both Claude Code and OpenAI Codex agents, handling agent selection via the AGENT environment variable or interactive prompts. It also manages exapump CLI installation/updates. ```shell #!/bin/sh # Example snippet from install.sh (actual script is more complex) # Agent selection if [ -z "$AGENT" ]; then echo "Select agent (claude, codex, both): " read AGENT fi case "$AGENT" in "claude") echo "Installing for Claude Code..." # Claude specific commands ;; "codex") echo "Installing for Codex..." # Codex specific commands ;; "both") echo "Installing for both agents..." # Commands for both agents ;; *) echo "Invalid agent selection." exit 1 ;; esac # Exapump version check and install/update echo "Checking exapump..." # ... exapump logic ... ``` -------------------------------- ### Install Exasol Agent Skills (Bash) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/README.md Installs Exasol Agent Skills using a curl script. It can install for both Claude Code and OpenAI Codex by default, or for a specific agent by setting the AGENT environment variable. ```bash curl -fsSL https://raw.githubusercontent.com/exasol-labs/exasol-agent-skills/main/install.sh | sh ``` ```bash export AGENT=claude curl -fsSL https://raw.githubusercontent.com/exasol-labs/exasol-agent-skills/main/install.sh | sh ``` ```bash export AGENT=codex curl -fsSL https://raw.githubusercontent.com/exasol-labs/exasol-agent-skills/main/install.sh | sh ``` -------------------------------- ### ADAPTER Scripts (Virtual Schemas) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Example of a Java ADAPTER script used to power Exasol Virtual Schemas. ```APIDOC ## ADAPTER Scripts (Virtual Schemas) ### Purpose Java ADAPTER scripts are used to implement Virtual Schemas, allowing Exasol to query data from external data sources as if it were in local Exasol tables. ### Example ADAPTER Script This script specifies the main class for the adapter and includes necessary JAR files from BucketFS. ```sql CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter_schema.jdbc_adapter AS %scriptclass com.exasol.adapter.RequestDispatcher; %jar /buckets/bfsdefault/default/virtual-schema-dist-12.0.0.jar; %jar /buckets/bfsdefault/default/postgresql-42.7.1.jar; -- No script body needed here, the logic is in the specified JARs / ``` - `%scriptclass`: Specifies the entry point class within the JARs. - `%jar`: References the required JAR files stored in BucketFS. ``` -------------------------------- ### Java UDF with External JARs Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Demonstrates how to use external JAR libraries within a Java UDF by uploading them to BucketFS and referencing them using the `%jar` directive. This example shows how to include custom logic and its dependencies. ```sql CREATE OR REPLACE JAVA SCALAR SCRIPT my_schema.custom_logic(input VARCHAR(2000)) RETURNS VARCHAR(2000) AS %scriptclass com.mycompany.CustomProcessor; %jar /buckets/bfsdefault/default/jars/my-library-1.0.0.jar; %jar /buckets/bfsdefault/default/jars/dependency.jar; / ``` -------------------------------- ### Uploading JARs to BucketFS Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Provides a bash command example using `curl` to upload a JAR file to Exasol's BucketFS. This is a prerequisite for using external JARs in Java UDFs. ```bash curl -X PUT -T my-library-1.0.0.jar http://w:@:2580/default/jars/ ``` -------------------------------- ### Java UDF with Custom JVM Options Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Shows how to configure Java Virtual Machine (JVM) options for a Java UDF using the `%jvmoption` directive. This example sets the initial and maximum heap size for a SET script. ```sql CREATE OR REPLACE JAVA SET SCRIPT my_schema.heavy_computation(val DOUBLE) EMITS (result DOUBLE) AS %jvmoption -Xms512m -Xmx2g; -- script body... / ``` -------------------------------- ### Add Conda Packages Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Demonstrates how to add Conda packages to an SLC flavor using `conda install` within the Dockerfile. Includes package name, version, and cleaning up Conda cache. ```dockerfile RUN conda install -y -c conda-forge \ scikit-learn=1.3.2 \ xgboost=2.0.3 && \ conda clean -afy ``` -------------------------------- ### SQL Running Total with QUALIFY Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt This SQL example shows how to calculate a running total of order amounts and filter results based on a cutoff value using the QUALIFY clause. It applies the SUM() window function ordered by order_date and keeps rows where the running total does not exceed 10000. ```sql -- Running total with cutoff SELECT order_date, amount, SUM(amount) OVER (ORDER BY order_date) AS running_total FROM orders QUALIFY SUM(amount) OVER (ORDER BY order_date) <= 10000; ``` -------------------------------- ### Customize Exasol SLC with Custom Python Packages using exaslct Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt This section details how to build custom Script Language Containers (SLCs) for Exasol, enabling the use of additional Python packages for UDFs. It covers installing the SLC build tool, configuring package dependencies, building, exporting, and deploying the custom container. ```bash # Install the SLC build tool pip install exasol-script-languages-container-tool # Clone the script-languages repository git clone --recurse-submodules https://github.com/exasol/script-languages-release.git cd script-languages-release # Add Python packages to: flavors//flavor_customization/packages/python3_pip_packages # Format: package_name|version cat > flavors/template-Exasol-all-python-3.10/flavor_customization/packages/python3_pip_packages << 'EOF' scikit-learn|1.3.2 pandas|2.1.4 numpy|1.26.2 xgboost|2.0.3 EOF # Add system packages if needed: flavor_customization/packages/apt_get_packages cat > flavors/template-Exasol-all-python-3.10/flavor_customization/packages/apt_get_packages << 'EOF' libgomp1 libopenblas-dev EOF # Build and export container exaslct export --flavor-path=flavors/template-Exasol-all-python-3.10 --export-path ./output # Deploy directly to BucketFS exaslct deploy --flavor-path=flavors/template-Exasol-all-python-3.10 \ --bucketfs-host db.example.com --bucketfs-port 2580 \ --bucketfs-user w --bucketfs-password secretpass \ --bucketfs-name bfsdefault --bucket default \ --path-in-bucket slc --bucketfs-use-https 1 # Generate activation SQL exaslct generate-language-activation --flavor-path=flavors/template-Exasol-all-python-3.10 \ --bucketfs-name bfsdefault --bucket-name default \ --path-in-bucket slc --container-name template-Exasol-all-python-3.10 ``` -------------------------------- ### Create Java UDF with External JAR Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt This example shows how to create a Java Scalar UDF that utilizes an external JAR file stored in Exasol's BucketFS. It specifies the main class and the JAR location, allowing the UDF to leverage custom Java libraries for complex processing. ```sql CREATE OR REPLACE JAVA SCALAR SCRIPT my_schema.custom_processor(input VARCHAR(2000)) RETURNS VARCHAR(2000) AS %scriptclass com.mycompany.MyProcessor; %jar /buckets/bfsdefault/default/jars/my-lib.jar; / ``` -------------------------------- ### Java ADAPTER Script for Virtual Schemas Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Defines a Java ADAPTER script used to power Exasol Virtual Schemas. This example specifies the main script class and includes necessary JAR files for JDBC drivers and the virtual schema distribution. ```sql CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter_schema.jdbc_adapter AS %scriptclass com.exasol.adapter.RequestDispatcher; %jar /buckets/bfsdefault/default/virtual-schema-dist-12.0.0.jar; %jar /buckets/bfsdefault/default/postgresql-42.7.1.jar; / ``` -------------------------------- ### Configure Exasol Cloud Storage Connections (S3, Azure, GCS) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/import-export.md Provides SQL examples for creating Exasol connection objects for S3, Azure Blob Storage, and Google Cloud Storage. These connections are required for IMPORT/EXPORT operations to cloud-based data sources. ```sql -- S3 Connection CREATE OR REPLACE CONNECTION s3_conn TO 'https://my-bucket.s3.eu-west-1.amazonaws.com' USER '' IDENTIFIED BY 'S3_ACCESS_KEY=AKIA...;S3_SECRET_KEY=secret...'; -- Azure Blob Storage Connection CREATE OR REPLACE CONNECTION azure_conn TO 'https://myaccount.blob.core.windows.net/mycontainer' USER '' IDENTIFIED BY 'AZURE_SAS_TOKEN=sv=2021-06-08&ss=b&srt=co...'; -- Google Cloud Storage Connection CREATE OR REPLACE CONNECTION gcs_conn TO 'https://storage.googleapis.com/my-bucket' USER '' IDENTIFIED BY 'GCS_ACCESS_KEY=GOOG...;GCS_SECRET_KEY=secret...'; ``` -------------------------------- ### Activate and Verify Custom SLC in Exasol SQL Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt This snippet shows how to activate a custom Script Language Container (SLC) with specific Python packages for a session or system-wide in Exasol. It includes SQL commands to set the SCRIPT_LANGUAGES parameter and a Python UDF to verify the installed packages and their versions. ```sql -- Activate custom SLC for current session ALTER SESSION SET SCRIPT_LANGUAGES='PYTHON3=localzmq+protobuf:///bfsdefault/default/slc/template-Exasol-all-python-3.10?lang=python#buckets/bfsdefault/default/slc/template-Exasol-all-python-3.10/exaudf/exaudfclient_py3'; -- Verify packages are available CREATE OR REPLACE PYTHON3 SCALAR SCRIPT test_packages() RETURNS VARCHAR(2000) AS import sklearn, pandas, numpy, xgboost def run(ctx): return f"sklearn={sklearn.__version__}, pandas={pandas.__version__}, numpy={numpy.__version__}, xgboost={xgboost.__version__}" / SELECT test_packages(); -- Returns: sklearn=1.3.2, pandas=2.1.4, numpy=1.26.2, xgboost=2.0.3 -- Activate system-wide (requires admin) ALTER SYSTEM SET SCRIPT_LANGUAGES='PYTHON3=localzmq+protobuf:///bfsdefault/default/slc/template-Exasol-all-python-3.10?lang=python#buckets/bfsdefault/default/slc/template-Exasol-all-python-3.10/exaudf/exaudfclient_py3'; ``` -------------------------------- ### Create R UDF for Batch ML Prediction Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt This example demonstrates creating an R Set UDF in Exasol for batch machine learning predictions. It loads a pre-trained model (RDS file) from BucketFS and processes data in batches, emitting predictions. This is ideal for applying statistical models to large datasets. ```sql -- R SET UDF for batch ML prediction CREATE OR REPLACE R SET SCRIPT my_schema.r_predict( feature1 DOUBLE, feature2 DOUBLE ) EMITS (prediction DOUBLE) AS run <- function(ctx) { # Load model from BucketFS model <- readRDS("/buckets/bfsdefault/default/models/model.rds") repeat { # Read rows in batches of 1000 if (!ctx$next_row(1000)) break df <- data.frame(f1 = ctx$feature1, f2 = ctx$feature2) ctx$emit(predict(model, newdata = df)) } } / ``` -------------------------------- ### Add System Packages (apt) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Details how to add system packages for an SLC flavor by editing the `apt_get_packages` file. Each package should be on a new line. ```text libgomp1 libopenblas-dev curl ``` -------------------------------- ### List Available exapump Profiles Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/SKILL.md Lists all available exapump profiles configured on the system. This command is used when an initial connection attempt fails, helping the user identify and select a valid profile for subsequent operations. It takes no arguments. ```bash exapump profile list ``` -------------------------------- ### Java SCALAR Script Example Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md Example of a Java SCALAR script that calculates the SHA-256 hash of an input string. ```APIDOC ## CREATE OR REPLACE JAVA SCALAR SCRIPT my_schema.hash_value ### Description Calculates the SHA-256 hash of an input string. ### Method CREATE OR REPLACE JAVA SCALAR SCRIPT ### Endpoint N/A (SQL Script) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None (Input is defined in the SQL script signature) ### Request Example ```sql CREATE OR REPLACE JAVA SCALAR SCRIPT my_schema.hash_value(input VARCHAR(2000)) RETURNS VARCHAR(64) AS import java.security.MessageDigest; class HASH_VALUE { static String run(ExaMetadata exa, ExaIterator ctx) throws Exception { String input = ctx.getString("input"); if (input == null) return null; MessageDigest md = MessageDigest.getInstance("SHA-256"); byte[] hash = md.digest(input.getBytes("UTF-8")); StringBuilder hex = new StringBuilder(); for (byte b : hash) hex.append(String.format("%02x", b)); return hex.toString(); } } / ``` ### Response #### Success Response (200) Returns the SHA-256 hash as a VARCHAR(64). #### Response Example ``` "a1b2c3d4e5f6..." ``` ``` -------------------------------- ### Manual Installation for OpenAI Codex Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/README.md Manually installs Exasol Agent Skills for OpenAI Codex using 'npx skills add'. This command adds the specified agent skill to the OpenAI Codex environment. ```bash npx skills add exasol-labs/exasol-agent-skills --agent codex ``` -------------------------------- ### Accessing BucketFS Files in Python Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/SKILL.md Demonstrates how to load resources, such as pickled machine learning models, from Exasol's BucketFS using Python's file handling and pickle module. ```python # Python — load a pickled ML model import pickle with open('/buckets/bfsdefault/default/models/model.pkl', 'rb') as f: model = pickle.load(f) ``` -------------------------------- ### Set Up Virtual Schemas for External Data Access in Exasol SQL Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt This snippet outlines the process of creating virtual schemas in Exasol to access external databases. It covers creating an adapter script, establishing a connection to the external database, defining the virtual schema, and querying external data. ```sql -- Create adapter script (requires JAR in BucketFS) CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter_schema.jdbc_adapter AS %scriptclass com.exasol.adapter.RequestDispatcher; %jar /buckets/bfsdefault/default/virtual-schema-dist-12.0.0.jar; %jar /buckets/bfsdefault/default/postgresql-42.7.1.jar; / -- Create connection to external PostgreSQL database CREATE OR REPLACE CONNECTION pg_conn TO 'jdbc:postgresql://host:5432/mydb' USER 'db_user' IDENTIFIED BY 'db_password'; -- Create virtual schema CREATE VIRTUAL SCHEMA pg_schema USING adapter_schema.jdbc_adapter WITH CONNECTION_NAME = 'PG_CONN' SCHEMA_NAME = 'public'; -- Query external data (pushdown to remote where possible) SELECT * FROM pg_schema.remote_table WHERE id > 100; -- Refresh metadata after remote schema changes ALTER VIRTUAL SCHEMA pg_schema REFRESH; ``` -------------------------------- ### Manage exapump Connection Profiles Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt Commands for creating, listing, and using connection profiles with the exapump CLI to securely manage Exasol database credentials. ```bash # Add a new profile (interactive - prompts for host, port, user, password, TLS) exapump profile add default # Add a named profile for different environments exapump profile add production exapump profile add staging # List all saved profiles exapump profile list # Test connection with default profile exapump sql "SELECT 1" # Test connection with specific profile (--profile goes after subcommand) exapump sql --profile staging "SELECT 1" ``` -------------------------------- ### Exasol Date and Time Functions Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exasol-sql.md Showcases several common date and time functions available in Exasol, including getting the current timestamp, adding days to a date, calculating the difference between dates, and formatting timestamps. ```sql SELECT CURRENT_TIMESTAMP; -- now SELECT ADD_DAYS(CURRENT_DATE, 7); -- 7 days from now SELECT DAYS_BETWEEN('2024-01-01', '2024-12-31'); -- day difference SELECT TO_CHAR(CURRENT_TIMESTAMP, 'YYYY-MM-DD'); -- format ``` -------------------------------- ### Deploy SLC to BucketFS Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Builds, exports, and uploads an SLC to Exasol's BucketFS using the `exaslct deploy` command. Requires detailed BucketFS connection parameters. ```bash exaslct deploy --flavor-path=flavors/ \ --bucketfs-host --bucketfs-port \ --bucketfs-user w --bucketfs-password \ --bucketfs-name --bucket \ --path-in-bucket --bucketfs-use-https 1 ``` -------------------------------- ### Using LIMIT and OFFSET in Exasol Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exasol-sql.md Illustrates how to use `LIMIT` and `OFFSET` clauses in Exasol queries for pagination. This allows fetching a specific subset of rows from a result set, ordered by a specified column. ```sql SELECT * FROM t ORDER BY id LIMIT 10 OFFSET 20; ``` -------------------------------- ### Exasol Regular Expression Functions (SQL) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exasol-sql.md Showcases Exasol's support for PCRE2 regular expressions through functions like REGEXP_LIKE, REGEXP_INSTR, REGEXP_REPLACE, and REGEXP_SUBSTR. Includes examples with capture groups and mentions supported PCRE2 features. ```sql -- Test if pattern matches SELECT REGEXP_LIKE('hello123', '^\w+\d+$'); -- TRUE -- Find position of match SELECT REGEXP_INSTR('abc 123 def', '\d+'); -- 5 -- Replace matches SELECT REGEXP_REPLACE('foo bar', '\s+', ' '); -- 'foo bar' -- Extract matching substring SELECT REGEXP_SUBSTR('abc 123 def', '\d+'); -- '123' -- With capture groups (extracting month) SELECT REGEXP_SUBSTR('2024-01-15', '(\d{4})-(\d{2})-(\d{2})', 1, 1, '', 2); -- '01' ``` -------------------------------- ### Generate Language Activation SQL with exaslct Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Generates the SQL statements required to activate a language flavor in Exasol. This command requires specifying the path to the flavor, BucketFS details, and the container name. ```bash exaslct generate-language-activation --flavor-path=flavors/ \ --bucketfs-name --bucket-name \ --path-in-bucket --container-name ``` -------------------------------- ### MERGE (Upsert) Statement in Exasol Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/exasol-sql.md Provides an example of the `MERGE` statement in Exasol, commonly known as an upsert operation. It allows conditional updating of existing rows or inserting new rows into a target table based on matching criteria with a source. ```sql MERGE INTO target t USING source s ON (t.id = s.id) WHEN MATCHED THEN UPDATE SET t.value = s.value WHEN NOT MATCHED THEN INSERT VALUES (s.id, s.value); ``` -------------------------------- ### Import Parquet Data from S3 into Exasol Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/import-export.md Shows the SQL syntax for importing Parquet data from an S3 bucket into Exasol. This example includes support for wildcards in file paths and mentions type mappings and column mapping options. ```sql IMPORT INTO my_schema.my_table FROM PARQUET AT s3_conn FILE 'data/*.parquet'; -- Example with parallel configuration: -- FILE 'data/*.parquet' (MaxConnections=10 MaxConcurrentReads=5) ``` -------------------------------- ### Build and Export SLC Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Builds an SLC and exports it as a `.tar.gz` archive using the `exaslct export` command. Requires specifying the flavor path and export path. ```bash exaslct export --flavor-path=flavors/ --export-path ./output ``` -------------------------------- ### Exasol Table Design: DISTRIBUTE BY for Row Distribution Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt Defines how rows are distributed across cluster nodes using a distribution key. This is crucial for optimizing join performance by ensuring related data resides on the same node. Includes examples for creating, altering, and checking table distribution. ```sql CREATE TABLE orders ( order_id DECIMAL(18,0) NOT NULL, customer_id DECIMAL(18,0) NOT NULL, order_date DATE, amount DECIMAL(10,2), DISTRIBUTE BY customer_id ); CREATE TABLE order_items ( item_id DECIMAL(18,0) NOT NULL, order_id DECIMAL(18,0) NOT NULL, product_id DECIMAL(18,0), quantity INT, price DECIMAL(10,2), DISTRIBUTE BY order_id ); ALTER TABLE orders DISTRIBUTE BY customer_id; SELECT iproc() AS node, COUNT(*) AS row_count FROM orders GROUP BY 1 ORDER BY 1; SELECT value2proc(customer_id) AS future_node, COUNT(*) FROM orders GROUP BY 1 ORDER BY 1; SELECT COLUMN_NAME, COLUMN_IS_DISTRIBUTION_KEY FROM EXA_ALL_COLUMNS WHERE COLUMN_TABLE = 'ORDERS' AND COLUMN_SCHEMA = 'MY_SCHEMA'; ``` -------------------------------- ### Create Lua Scalar Script for Averaging Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-java-lua.md This SQL snippet demonstrates how to create a Lua scalar script named 'my_average' that takes two DOUBLE arguments and returns their average. It handles null inputs by returning null and includes an example of how to select from this script. ```sql CREATE OR REPLACE LUA SCALAR SCRIPT my_schema.my_average(a DOUBLE, b DOUBLE) RETURNS DOUBLE AS function run(ctx) if ctx.a == nil or ctx.b == nil then return null end return (ctx.a + ctx.b) / 2 end / SELECT my_average(x, y) FROM t; ``` -------------------------------- ### Test Exasol UDFs Locally with Python Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-python.md Demonstrates how to use the udf-mock-python library to mock Exasol UDF execution. It sets up mock metadata, environment, and executor to run a simple scalar UDF and verify its output. Limitations include no BucketFS access, import/export specs, dynamic output parameters, parallel execution, or container isolation. ```python from exasol_udf_mock_python.mock_meta_data import MockMetaData from exasol_udf_mock_python.mock_exa_environment import MockExaEnvironment from exasol_udf_mock_python.mock_executor import UDFMockExecutor from exasol_udf_mock_python.column import Column from exasol_udf_mock_python.group import Group def udf_wrapper(): def run(ctx): return ctx.val * 2 return run executor = UDFMockExecutor() meta = MockMetaData( script_code_wrapper_function=udf_wrapper, input_type="SCALAR", input_columns=[Column("val", int, "INTEGER")], output_type="RETURNS", output_columns=[Column("result", int, "INTEGER")] ) exa = MockExaEnvironment(meta) result = executor.run([Group([(5,), (10,)])], exa) # result[0].rows == [(10,), (20,)] ``` -------------------------------- ### Exaslct Command Reference Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Lists and describes the available exaslct commands for building, exporting, deploying, and managing script language containers. ```bash exaslct build ``` ```bash exaslct export ``` ```bash exaslct deploy ``` ```bash exaslct upload ``` ```bash exaslct generate-language-activation ``` ```bash exaslct security-scan ``` ```bash exaslct run-db-tests ``` ```bash exaslct clean ``` -------------------------------- ### Activating Script Languages in SQL Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/SKILL.md Provides SQL commands to activate specific script languages, like Python, for the current session or system-wide. It shows the format for specifying the language and its location in BucketFS. ```sql -- Activate for current session ALTER SESSION SET SCRIPT_LANGUAGES='PYTHON3=localzmq+protobuf://////?lang=python#buckets/////exaudf/exaudfclient_py3'; -- Activate system-wide (requires admin) ALTER SYSTEM SET SCRIPT_LANGUAGES='...'; ``` -------------------------------- ### Create, View, and Drop Exasol Connection Objects Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/import-export.md Demonstrates the SQL syntax for creating, viewing, and dropping connection objects in Exasol. Connection objects are used to store credentials for accessing remote data sources, particularly for cloud IMPORT/EXPORT operations. ```sql CREATE OR REPLACE CONNECTION my_conn TO 'connection-url' USER 'username' IDENTIFIED BY 'password'; SELECT * FROM EXA_DBA_CONNECTIONS; DROP CONNECTION my_conn; ``` -------------------------------- ### Exasol Table Design: PARTITION BY for Data Layout Source: https://context7.com/exasol-labs/exasol-agent-skills/llms.txt Controls the physical layout of data within tables, enabling range pruning for time-series and filtered queries. This optimizes read performance by allowing the database to scan only relevant data partitions. Includes examples for creating, altering, and querying partitioned tables. ```sql CREATE TABLE events ( event_id DECIMAL(18,0) NOT NULL, customer_id DECIMAL(18,0) NOT NULL, event_date DATE, event_type VARCHAR(100), payload VARCHAR(2000000), DISTRIBUTE BY customer_id, PARTITION BY event_date ); ALTER TABLE events PARTITION BY event_date; SELECT * FROM events WHERE event_date BETWEEN '2024-01-01' AND '2024-03-31'; ``` -------------------------------- ### Add R Packages (CRAN) Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Explains how to add R packages from CRAN for an SLC flavor by editing the `r_cran_packages` file. Supports package name and optional version. ```text dplyr|1.1.4 data.table ``` -------------------------------- ### Create Lua SCALAR UDF for averaging Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/SKILL.md Defines a Lua SCALAR User Defined Function (UDF) named 'my_avg' that calculates the average of two DOUBLE input values. It handles potential NULL inputs and returns the calculated average. This UDF is a simple example of Lua scripting within Exasol. ```sql CREATE OR REPLACE LUA SCALAR SCRIPT my_schema.my_avg(a DOUBLE, b DOUBLE) RETURNS DOUBLE AS function run(ctx) if ctx.a == nil or ctx.b == nil then return null end return (ctx.a + ctx.b) / 2 end / ``` -------------------------------- ### Dynamic Imports for External Packages in Python UDF Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/udf-python.md Demonstrates how to import Python packages that are installed in the Exasol's Software Layer Container (SLC). This is necessary for using libraries like `textblob` within your UDF. The import statement must be placed within the `run` function if it's specific to that function's logic. ```sql CREATE OR REPLACE PYTHON3 SCALAR SCRIPT my_schema.sentiment(text VARCHAR(10000)) RETURNS DOUBLE AS def run(ctx): from textblob import TextBlob -- Must be installed in the SLC blob = TextBlob(ctx.text) return blob.sentiment.polarity / ``` -------------------------------- ### Import Compressed Files (ZIP, GZ, BZ2) into Exasol Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/import-export.md Explains that Exasol automatically detects and decompresses common archive formats like .zip, .gz, and .bz2 during the IMPORT process. No special syntax is required; simply reference the compressed file name. ```sql IMPORT INTO my_table FROM CSV AT s3_conn FILE 'data/archive.csv.gz'; ``` -------------------------------- ### SQL Navigation Functions with Window Functions Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/analytics-qualify.md Shows how to use navigation window functions like LAG, LEAD, FIRST_VALUE, and LAST_VALUE. These functions allow access to data from preceding or succeeding rows within a partition or the entire result set, enabling comparisons and trend analysis. ```sql SELECT order_date, revenue, LAG(revenue, 1) OVER (ORDER BY order_date) AS prev_day, LEAD(revenue, 1) OVER (ORDER BY order_date) AS next_day, FIRST_VALUE(employee) OVER (PARTITION BY dept ORDER BY salary DESC) AS top_earner, LAST_VALUE(employee) OVER ( PARTITION BY dept ORDER BY salary DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS lowest_earner FROM daily_sales; ``` -------------------------------- ### Import Data from Multiple Files or Wildcards in Exasol Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/import-export.md Shows how to import data from multiple files or using wildcards in Exasol's IMPORT statement. This allows for loading data from numerous files in parallel, either by specifying multiple FILE clauses or using wildcard patterns. ```sql -- Using a wildcard IMPORT INTO my_table FROM CSV AT s3_conn FILE 'data/2024/*.csv'; -- Using multiple FILE clauses IMPORT INTO my_table FROM CSV AT s3_conn FILE 'data/region_a/orders.csv' FILE 'data/region_b/orders.csv' FILE 'data/region_c/orders.csv'; ``` -------------------------------- ### Export Container with Registry Caching Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-udfs/references/slc-reference.md Exports a container flavor while utilizing a remote registry for caching, which can significantly speed up build times. Requires specifying the flavor path, output path, registry URL, and a tag. ```bash exaslct export --flavor-path=flavors/ --export-path ./output \ --cache-registry --cache-tag ``` -------------------------------- ### Create Table with DISTRIBUTE BY and PARTITION BY Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/plugins/exasol/skills/exasol-database/references/table-design.md Defines a table with both a distribution key for optimizing joins and a partitioning key for efficient data pruning based on range filters. This combines the benefits of both strategies. ```sql CREATE TABLE orders ( order_id INT, customer_id INT, order_date DATE, amount DECIMAL(10,2), DISTRIBUTE BY customer_id, PARTITION BY order_date ); ``` -------------------------------- ### Manifest Validation using Claude CLI Source: https://github.com/exasol-labs/exasol-agent-skills/blob/main/CLAUDE.md Demonstrates how to validate plugin manifests locally using the `claude` CLI. This is performed outside of the Docker testing environment to ensure manifest integrity before deployment. ```bash # Validate the root marketplace manifest claude plugin validate . # Validate the Exasol plugin manifest claude plugin validate ./plugins/exasol ```