This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker compose up run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker build -t <image-name> . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:latest | |
WORKDIR app | |
COPY . /app | |
RUN python3 -m pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psycopg2==2.9.3 | |
pytest== 7.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
services: | |
postgres: | |
image: postgres:10.5 | |
restart: always | |
environment: | |
- POSTGRES_USER=<username> | |
- POSTGRES_PASSWORD=<password> | |
ports: | |
- '5433:5432' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Key Docker Commands | |
docker build --pull --no-cache --tag=<image-name> . | |
docker-compose up | |
docker-compose down |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Transformation | |
df = df.withColumn("latitude", col("latitude").cast(DoubleType()))\ | |
.withColumn("longitude", col("longitude").cast(DoubleType())) | |
df.printSchema() | |
df.show(10) | |
#More Insight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql import SparkSession | |
from pyspark.sql.types import DoubleType | |
from pyspark.sql.functions import col | |
jar_path = 'rds_jar_driver.jar' | |
spark = SparkSession \ | |
.builder \ | |
.appName("AWS REDSHIFT PYSPARK APP") \ | |
.config("spark.jars", jar_path)\ | |
.config('spark.driver.extraClassPath', jar_path) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COPY seattle_emergence_calls from 's3://seattle-realtime-emergence-fire-call/Seattle_Real_Time_Fire_911_Calls.csv' FORMAT CSV | |
IGNOREHEADER 1 | |
CREDENTIALS 'aws_iam_role=your_iam_role' | |
REGION 'us-east-1'; |
NewerOlder