Skip to content

Instantly share code, notes, and snippets.

View onefoursix's full-sized avatar

Mark Brooks onefoursix

View GitHub Profile
@onefoursix
onefoursix / create_jdbc_connection_using azure_key_vault.py
Created March 22, 2025 01:38
Example StreamSets Python SDK script to create a JDBC Connection with credentials retrieved from Azure Key Vault
"""
FILE: create_jdbc_connection_using azure_key_vault.py
DESCRIPTION: This script provides an example of how to create a
STREAMSETS_JDBC Connection wit credentials pulled from
Azure Key Vault using the StreamSets SDK
USAGE: $ python3 create_connection.py
@onefoursix
onefoursix / create_kafka_sasl_connection.py
Last active March 22, 2025 01:35
An example Python script that creates a StreamSets Kafka Connection using SASL
"""
FILE: create_kafka_sasl_connection.py
DESCRIPTION: This script provides an example of how to create a
STREAMSETS_KAFKA Connection that uses sasl using the StreamSets SDK
USAGE: $ python3 create_kafka_sasl_connection.py
PREREQUISITES:
@onefoursix
onefoursix / create_connection.py
Last active March 22, 2025 01:34
This script provides an example of how to create a STREAMSETS_ADLS_GEN2 Connection using the StreamSets SDK
"""
FILE: create_connection.py
DESCRIPTION: This script provides an example of how to create a
STREAMSETS_ADLS_GEN2 Connection using the StreamSets SDK
USAGE: $ python3 create_connection.py
PREREQUISITES:
@onefoursix
onefoursix / log4j2.properties
Last active March 13, 2025 22:15
An example log4j2.properties file that enables JSON-based logging for StreamSets engine
#
# IBM Confidential
# PID 5900-BAF
# Copyright StreamSets Inc., an IBM Company 2024
#
name = datacollectorLog
# reload interval
monitorInterval=10
@onefoursix
onefoursix / job_metrics.py
Last active March 12, 2025 04:01
A Python script to get StreamSets Job Metrics using the StreamSets Python SDK
#!/usr/bin/env python
'''
A simple script to get Job run history and metrics for the latest run of each Job.
Example output looks like this:
-------------------------------------
$ python3 job_metrics.py
{"job_id": "f2275440-be70-444f-b25e-2c54619ad507:8030c2e9-1a39-11ec-a5fe-97c8d4369386", "job_name": "d2t", "create_time": 1726509431556, "last_modified": 1736300865377, "pipeline_name": "d2t", "pipeline_commit_label": "v3", "run_count": 2, "start_time": 1736300867197, "finish_time": 1736300888095, "error_message": null, "color": "GRAY", "status": "INACTIVE", "input_records": 1, "output_records": 1, "error_records": 0}
{"job_id": "a8f45d57-49c7-463d-b48d-982bd967d725:8030c2e9-1a39-11ec-a5fe-97c8d4369386", "job_name": "DEV Job for P1", "create_time": 1723151084016, "last_modified": 1723151088514, "pipeline_name": "d 2 t", "pipeline_commit_label": "v3", "run_count": 4, "start_time": 1741046427629, "finish_time": 1741048987802, "error_message": "JOBRUNNER_65 - A Data Collectors engine didn't respond to the stop
@onefoursix
onefoursix / groovyEmail.groovy
Created December 1, 2024 06:09
StreamSets Groovy script to get email attachments (work in progress)
import java.util.Properties
import jakarta.mail.*
import jakarta.mail.search.*
import java.nio.file.*
import java.util.*
import java.text.SimpleDateFormat
// IMAP Connection Parameters
String host = sdc.userParams["IMAP_SERVER_HOST"];
String user = sdc.userParams["EMAIL_USER"];
@onefoursix
onefoursix / Main.java
Last active November 21, 2024 03:08
StreamSets / Snowflake TIMESTAMP_TZ issue reproducer
package test;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileInputStream;
import java.util.Properties;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
@onefoursix
onefoursix / deployment.yaml
Created October 25, 2024 23:44
Example StreamSets Deployment manifest with keystore and truststore Volume and VolumeMounts
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: streamsets-deployment-b039f713-794f-45c7-9c1b-4fec9e94f5af
vendor: streamsets-sch
env: na01
name: streamsets-deployment-b039f713-794f-45c7-9c1b-4fec9e94f5af
namespace: ns1
spec:
@onefoursix
onefoursix / cilium-streamsets-engine.yaml
Last active October 14, 2024 02:15
Cilium Network Policy for StreamSets Engines
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: cnp-streamsets-engine
namespace: <your namespace>
spec:
endpointSelector:
matchLabels:
"streamsets": engine
egress:
@onefoursix
onefoursix / cilium-streamsets-agent.yaml
Last active October 15, 2024 17:50
Cilium Network Policy for IBM StreamSets Agent
apiVersion: cilium.io/v2
kind: CiliumNetworkPolicy
metadata:
name: cnp-streamsets-agent
namespace: <your namespace>
spec:
endpointSelector:
matchLabels:
"streamsets": agent
egress: