Skip to content

Instantly share code, notes, and snippets.

@j-thepac
j-thepac / ETL.md
Last active January 13, 2025 13:27

ETL

BigData:

  • OLTP (online Transactional processing)
  • OLAP(online analytical processing)

Data processing systems

  • OLTP (OnLine Transaction Processing) : is used for managing current day to day data information.
    • ACID
  • Atomicity(entire transaction happens at once or nothing happens)

System

  • Sop (std operation procedure)
  • Rca (root cause analysis)
  • Modular
  • Scalable
  • Scheme agnostic (No SqL) : No Schema
  • Model
  • Decouple
from pyspark.sql.window import Window
"""
Aggregate: min, max, avg, count, and sum.
Ranking: rank, dense_rank, percent_rank, row_num, and ntile
Analytical: cume_dist, lag, and lead
Custom boundary: rangeBetween and rowsBetween
"""

Delta Lake

quick link

Issues in Spark :

  • Cannot update /change date
  • No schema enforcement
  • No delta load
  • Data can be messed in overwrite

Adv of Delta Lake

@j-thepac
j-thepac / jsonVsYaml.yaml
Last active October 12, 2022 14:29
YAML VS JSON
# ----------------JSON VS YAML/YML-----------------
# 2 Spaces and No TABS !!!
# Comment
# Array
[1,2]
- 1
- 2
@j-thepac
j-thepac / dockerfile
Last active August 30, 2022 10:28
Scala DockerImage
# docker build -t somename:v1 .
# docker run -it nicearray:v1
# kubectl create deployment somename --image=somename:v1
FROM broadinstitute/scala-baseimage
COPY $PWD /home/apps/
WORKDIR /home/apps
CMD scala File.scala
@j-thepac
j-thepac / scalaHttpClient.md
Last active August 18, 2022 10:37
Run Http Client in spark REPL for Scala

HttpClient in spark-shell REPL

$spark-shell --packages com.softwaremill.sttp.client3:core_2.12:3.7.4

@j-thepac
j-thepac / dockerfile
Last active April 8, 2023 17:36
Kafka_Docker <not Working>
#Image to only DOwnload kafka
# docker-compse file to start zookeeper and broker is not ready !!!
FROM ibmjava
RUN apt-get update && \
apt-get install -y curl
RUN mkdir /tmp/kafka
RUN curl https://downloads.apache.org/kafka/3.2.0/kafka_2.12-3.2.0.tgz -o /tmp/kafka/kafka_2.12-3.2.0.tgz
RUN cd /tmp/kafka && \
@j-thepac
j-thepac / kafkaconfluentImage.yaml
Created July 15, 2022 12:59
kafkaconfluentImage
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- 22181:2181

Kafka Stream / Kafka based stream processors

Kafka Streams will consume topics , transformed and sank in some other topics ie., input and output of Kafka Stream is Topics

Adv:

  • Lightweight – no external dependencies other than Kafka
  • Scale out horizontally
  • Use Scala
  • code is very readable.
  • perform both stateless transformations / stateful aggregations and joins
  • Supports common stream processing such as dwindowing