Delta Lake - Focus - Optimisation & Tuning

# Deep Dive : Optimisation & Tuning (Delta Lake - Databricks)

> **Prérequis** : Guide principal Delta Lake, Deep Dive MERGE  
> **Objectif** : Maximiser les performances de lecture et écriture  
> **Contexte** : Pipelines IoT à haut débit

---

## Table des matières

1. [Le problème des petits fichiers](#1-le-problème-des-petits-fichiers)
2. [OPTIMIZE : compaction](#2-optimize--compaction)
3. [Z-ORDER : clustering des données](#3-z-order--clustering-des-données)
4. [Liquid Clustering (Databrick

Delta Lake - Focus - Merge Patterns

# Deep Dive : MERGE Patterns (Delta Lake - Databricks)

> **Prérequis** : Guide principal Delta Lake  
> **Objectif** : Maîtriser MERGE pour tous les cas d'usage  
> **Contexte** : Pipelines IoT, CDC, dimensions

---

## Table des matières

1. [Anatomie du MERGE](#1-anatomie-du-merge)
2. [Pattern : Upsert simple](#2-pattern--upsert-simple)
3. [Pattern : Déduplication](#3-pattern--déduplication)
4. [Pattern : SCD Type 1](#4-pattern--scd-type-1)
5. [Pattern : SCD Type 2](#5-pattern--scd-type-2)
6.

Delta Lake - Overview

# Delta Lake : Guide Complet (Databricks)

> **Contexte** : Formation Data Engineer  
> **Environnement** : Databricks (fonctionnalités spécifiques signalées)  
> **Cas d'usage** : Pipelines IoT  
> **Prérequis** : Bases Spark SQL, notions de Structured Streaming

---

## Table des matières

1. [Qu'est-ce que Delta Lake ?](#1-quest-ce-que-delta-lake)
2. [Architecture et concepts fondamentaux](#2-architecture-et-concepts-fondamentaux)
3. [Opérations de base](#3-opérations-de-base)
4. [MERGE : l'o

Spark Streaming - Focus - Triggers

# Focus : Triggers (ProcessingTime, Once, AvailableNow, Continuous)

> **Prérequis** : Guide principal  
> **Objectif** : Choisir le trigger adapté à ton SLA  
> **Format** : Focus pratique (~250 lignes)

---

## 1. Les triggers en une image

```
┌─────────────────────────────────────────────────────────────┐
│                    TYPES DE TRIGGERS                        │
├─────────────────────────────────────────────────────────────┤
│                                                            

main v1

# =========================
# main.py
# =========================

import sys
import subprocess
import importlib
import importlib.util

# ------------------------------------------------------------
# Automatisches pip-Upgrade (falls veraltet)
# ------------------------------------------------------------
try:
    print("🔄 Prüfe auf pip-Update ...")
    subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
    print("✅ pip erfolgreich aktualisiert.")

erkennung v2

# erkennung.py
import os
import re
import json
import requests
from typing import Optional
from ics import Calendar
from fuzzywuzzy import process, fuzz
from openai import OpenAI
from dotenv import load_dotenv
from datetime import datetime
import csv


# ---------------------------
# 🔐 ENV-Dateien laden & prüfen (mit Fallbacks)
# ---------------------------
benutzer_fallbacks = ["bernh", "Bernhard Holl", "XeisWorks"]

# --- OpenAI ---
openai_env_path = ""
for benutzer in ben

termingenerator v1

# =========================
# termingenerator.py
# =========================

import os
import random
import re
from typing import Optional
from datetime import datetime, date, timedelta

from icalendar import Calendar
from dateutil import tz
from tqdm import tqdm
import holidays

from erkennung import (
    ort_erkennen,
    FALLBACK_ORTE,
    google_geocode_ort,
    speichere_fallback_ort
)

# ------------------------------------------------------------
# ICS-Einträge ei

ics-import v1

# erkennung.py
import os
import re
import json
import requests
from typing import Optional
from ics import Calendar
from fuzzywuzzy import process, fuzz
from openai import OpenAI
from dotenv import load_dotenv
from datetime import datetime
import csv


# ---------------------------
# 🔐 ENV-Dateien laden & prüfen (mit Fallbacks)
# ---------------------------
benutzer_fallbacks = ["bernh", "Bernhard Holl", "XeisWorks"]

# --- OpenAI ---
openai_env_path = ""
for benutzer in ben

erkennung.py v1

# erkennung.py
import os
import re
import json
import requests
from erkennung import parse_ics_termine
from typing import Optional
from ics import Calendar
from fuzzywuzzy import process, fuzz
from openai import OpenAI
from dotenv import load_dotenv
from datetime import datetime
import csv


# ---------------------------
# 🔐 ENV-Dateien laden & prüfen (mit Fallbacks)
# ---------------------------
benutzer_fallbacks = ["bernh", "Bernhard Holl", "XeisWorks"]

# --- OpenAI ---

シンボリックリンク作成

■CMD(管理者権限あり)
mklink /D "コピー先リンク" "コピー元リンク"

■CMD(管理者権限なし)
mklink /J "コピー先リンク" "コピー元リンク"

ex) mklink /J "C:\Users\daido.takuya\Local Sites\tcb-multi-lang\app\public\wp-content\mu-plugins" "C:\Users\daido.takuya\Desktop\作業環境\mu-plugins"

■powershell(管理者権限あり)
New-Item -ItemType SymbolicLink `
  -Path "コピー先リンク" `
  -Target "コピー元リンク"

マルチサイト化(サブティレクトリ)

■流れ
wp-contentと同階層にフォルダを作成し、WPを設置する。
↓
.htaccessのRewriteBase,RewriteRuleにサブディレクトリ名を記載
↓
wp-config.phpのdefine( 'DB_NAME', '' )にサブディレクトリのWPのDB名を記載
↓
コピー元のDBをエクスポートし、新規DBにインポートする。
↓
新規DBのwp-options.php内のURLをサブディレクトリ用に変更する。
↓
パーマリンクを更新する。

■チェック項目
・マイグレーションデータ入れても、投稿のテンプレートはデフォルトのままになるので再設定が必要。
・リンク通るまでに時間かかる。

3573. Best Time to Buy and Sell Stock V

You are given an integer array prices where prices[i] is the price of a stock in dollars on the ith day, and an integer k. You are allowed to make at most k transactions, where each transaction can be either of the following: Normal transaction: Buy on day i, then sell on a later day j where i < j. You profit prices[j] - prices[i]. Short selling transaction: Sell on day i, then buy back on a later day j where i < j. You profit prices[i] - prices[j]. Note that you must complete each transaction before starting another. Additionally, you can't buy or sell on the same day you are selling or buying back as part of a previous transaction. Return the maximum total profit you can earn by making at most k transactions.
/**
 * @param {number[]} prices
 * @param {number} k
 * @return {number}
 */
var maximumProfit = function(prices, k) {
    // Edge cases
    const n = prices.length;
    if (n === 0 || k === 0) return 0;

    // We will NOT use the "unlimited transactions" shortcut because
    // the problem forbids opening a new position on the same day we close one.
    // That restriction breaks the usual greedy sum of daily deltas.

    // dp[t][i][state]
    // - t: number of COMPLETED transactions so far (

Spark Streaming - Focus - Modes de Sortie

# Focus : Modes de Sortie (Append, Update, Complete)

> **Prérequis** : Guide principal, notions de watermark  
> **Objectif** : Choisir le bon mode selon le use case  
> **Format** : Focus pratique (~250 lignes)

---

## 1. Les trois modes en une image

```
┌─────────────────────────────────────────────────────────────┐
│                    MODES DE SORTIE                          │
├─────────────────────────────────────────────────────────────┤
│                                                

Spark Streaming - Deep Dive - Architecture Medaillon

# Deep Dive : Architecture Médaillon (Bronze / Silver / Gold)

> **Prérequis** : Guide principal, Deep Dives Watermarks et Checkpointing  
> **Objectif** : Implémenter un pipeline Médaillon robuste en streaming  
> **Contexte** : Pipelines IoT avec Delta Lake

---

## Table des matières

1. [Philosophie et principes](#1-philosophie-et-principes)
2. [Couche Bronze : ingestion brute](#2-couche-bronze--ingestion-brute)
3. [Couche Silver : conformité et qualité](#3-couche-silver--conformité-et-quali

Spark Streaming - Deep Dive - Checkpoints

# Deep Dive : Checkpointing et Tolérance aux Pannes

> **Prérequis** : Lecture du guide principal (section 4), Deep Dive Watermarks  
> **Objectif** : Maîtriser la persistance d'état et la reprise sur erreur  
> **Contexte** : Pipelines IoT en production

---

## Table des matières

1. [Pourquoi le checkpoint est vital](#1-pourquoi-le-checkpoint-est-vital)
2. [Anatomie d'un checkpoint](#2-anatomie-dun-checkpoint)
3. [Configuration et stockage](#3-configuration-et-stockage)
4. [Scénarios de recov

Spark Streaming - Deep Dive - Fenêtres Temporelles et Watermarks

# Deep Dive : Fenêtres Temporelles et Watermarks

> **Prérequis** : Lecture du guide principal (sections 1, 6)  
> **Objectif** : Maîtriser la gestion du temps en streaming  
> **Approche** : Complexité croissante, du cas simple aux scénarios avancés

---

## Table des matières

1. [Pourquoi c'est difficile](#1-pourquoi-cest-difficile)
2. [Les deux temps du streaming](#2-les-deux-temps-du-streaming)
3. [Anatomie d'un Watermark](#3-anatomie-dun-watermark)
4. [Fenêtres en profondeur](#4-fenêtres-e