Skip to content

Instantly share code, notes, and snippets.

View ralfbecher's full-sized avatar

Ralf Becher ralfbecher

View GitHub Profile
@ralfbecher
ralfbecher / movies_non-collab.yml
Last active March 15, 2026 07:56
OrionBelt Semantic Layer: Simple Movies DB query to demonstrate Dimension-Exclude (anti-join via EXCEPT)
select:
dimensions:
- Director
- Producer
dimensionsExclude: true
order_by:
- field: Director
- field: Producer
limit: 50
@ralfbecher
ralfbecher / movies_OBML.yml
Last active March 15, 2026 12:54
OrionBelt Semantic Layer: Simple Movies DB OBML to demonstrate Dimension-Exclude (anti-join via EXCEPT)
version: 1.0
dataObjects:
Movies:
code: movies
database: demo
schema: movies
synonyms: [film]
columns:
Movie ID:
@ralfbecher
ralfbecher / movies_DML.sql
Created March 14, 2026 20:50
OrionBelt Semantic Layer: Simple Movies DB DML to demonstrate Dimension-Exclude (anti-join via EXCEPT)
-- Optional cleanup
TRUNCATE TABLE movie_producers,
movie_directors,
movies,
producers,
directors RESTART IDENTITY CASCADE;
-- Directors
INSERT INTO
directors (director_id, name)
@ralfbecher
ralfbecher / movies_DDL.sql
Created March 14, 2026 20:49
OrionBelt Semantic Layer: Simple Movies DB DDL to demonstrate Dimension-Exclude (anti-join via EXCEPT)
CREATE TABLE directors (
director_id INT PRIMARY KEY,
name VARCHAR(200) NOT NULL
);
CREATE TABLE producers (
producer_id INT PRIMARY KEY,
name VARCHAR(200) NOT NULL
);
@ralfbecher
ralfbecher / puppini_bridge_uss_1.sql
Created September 8, 2025 10:09
LLM generated virtual USS SQL View
-- =====================================================================
-- VIRTUAL PUPPINI BRIDGE - UNIFIED STAR SCHEMA (USS)
-- Schema: uss_1
-- Purpose: Create a unified fact table combining all business processes
-- (sales, purchases, shipments, returns) with conformed dimensions
-- Author: Ralfo Becher, OrionBelt
-- Date: 2025
-- =====================================================================
CREATE OR REPLACE VIEW uss_1.v_unified_star_schema AS
@ralfbecher
ralfbecher / orionbelt_1_DML_pg.sql
Created September 8, 2025 10:08
Load Sample Data
SET schema 'orionbelt_1';
-- Clear existing data (if any)
TRUNCATE TABLE clientcomplaints CASCADE;
TRUNCATE TABLE acctbal CASCADE;
TRUNCATE TABLE returns CASCADE;
TRUNCATE TABLE shipments CASCADE;
TRUNCATE TABLE purchases CASCADE;
TRUNCATE TABLE sales CASCADE;
TRUNCATE TABLE calendar CASCADE;
@ralfbecher
ralfbecher / orionbelt_1_DDL_pg.sql
Created September 8, 2025 10:05
Generate Test Data Schema
-- create schema orionbelt_1;
set schema 'orionbelt_1'; -- ensures that you work on this schema, and not on the default public
-- tables summary:
drop table if exists clients cascade;
drop table if exists products cascade;
drop table if exists sales cascade;
drop table if exists shipments cascade;
ʕ◔ϖ◔ʔ
U+0295, U+25D4, U+03D6, U+25D4, U+0294
@ralfbecher
ralfbecher / getSnowflakeQueryID.go
Last active February 6, 2021 09:44
Golang get Snowflake QueryID out of *sql.Rows
import (
"context"
"database/sql"
"database/sql/driver"
"errors"
"reflect"
// ...
sf "github.com/snowflakedb/gosnowflake"
)
@ralfbecher
ralfbecher / mashupEnigmaRequire.js
Created February 6, 2018 16:07
Qlik Sense Mashup with Enigma.js - the official way
var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config({
baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
});