Skip to content

Instantly share code, notes, and snippets.

@romaklimenko
romaklimenko / memory_pipeline.py
Created October 14, 2026 19:28
memory_pipeline.py
# Databricks notebook source
# MAGIC %md
# MAGIC # From two messages to long-term memory
# MAGIC Run with Python 3.10+ and `databricks-agentbricks==0.5.0` installed.
# MAGIC Uses paid Lakebase storage, one serverless pipeline run, and model calls.
# MAGIC Creates dedicated stores and removes them after the run reaches a terminal state.
# COMMAND ----------
import json
import os
SELECT
current_timestamp() AS tested_at,
current_version().dbr_version AS dbr_version,
current_version().dbsql_version AS dbsql_version;
-- COMMAND ----------
-- Remove the :response.answers.team.choice::STRING suffix to inspect
-- the full result, including error_message, if a label is NULL.
SELECT
@romaklimenko
romaklimenko / metric_views.sql
Created April 6, 2026 17:32
Databricks Metric Views
-- Databricks notebook source
CREATE SCHEMA IF NOT EXISTS demo.metric_views;
USE demo.metric_views;
-- Regions
CREATE OR REPLACE TABLE regions (region_id INT, region_name STRING);
INSERT INTO regions
VALUES (1, 'EMEA'), (2, 'AMER'), (3, 'APAC');
@romaklimenko
romaklimenko / pbix_internals.py
Last active May 11, 2025 18:59
Looking into *.pbix insides
# pylint: disable=missing-module-docstring, missing-function-docstring
import argparse
import json
import os
import shutil
TEMP_DIR = "temp"
def _reset_temp_dir():
@romaklimenko
romaklimenko / pipeline-json-to-mermaid.py
Last active April 30, 2025 07:15
Convert Azure Pipeline JSON to Mermaid Flowchart
# pylint: disable=missing-module-docstring, missing-function-docstring
import argparse
import json
import re
# Function to generate Mermaid diagram from Azure pipeline JSON
def san_id(name):
return re.sub(r'\W+', '_', name)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
import argparse
import time
from datetime import timedelta
import cluedin
def main(context_file: str, query_string: str) -> None:
@romaklimenko
romaklimenko / context.json
Created November 13, 2024 13:00
Create CluedIn users
{
"protocol": "http",
"domain": "cluedin.local:8888",
"org_name": "foobar",
"user_email": "admin@foobar.com",
"user_password": "Password23!"
}
# Install Microsoft Fabric extension
az extension add --name microsoft-fabric --allow-preview true
# List Fabric capacities
az fabric capacity list --output table
# Example output:
# Location Name ProvisioningState ResourceGroup State
# ----------- ---------------- ------------------- --------------- -------
# West Europe capacity81e0bf39 Succeeded fabric Active
@romaklimenko
romaklimenko / build_hierarchy.py
Last active September 4, 2024 13:04
CluedIn Hierarchies
# pylint: disable=missing-module-docstring missing-function-docstring fixme
import datetime
import json
import cluedin
from hierarchy_utils import (convert_tree_to_values, create_hierarchy,
save_hierarchy)