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
import pyodbc | |
import pandas as pd | |
df = pd.read_csv('myfile.csv') | |
MY_TABLE = 'some_tbl' | |
conn = pyodbc.connect(driver='{ODBC Driver 17 for SQL Server}', | |
server='MYSERVER', | |
database='MYDB', | |
uid='MYUSER', pwd='MYPASSWORD') |
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
""" | |
Dataset used: https://datasets.wri.org/dataset/globalpowerplantdatabase | |
""" | |
import os | |
import time | |
import pandas as pd | |
from datetime import datetime, timedelta | |
import awswrangler as wr | |
from boto3.dynamodb.conditions import Key |
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
import boto3 | |
import uuid | |
import json | |
import random | |
import logging | |
from datetime import datetime | |
logging.basicConfig(format="[%(levelname)s] [%(name)s] [%(asctime)s]: %(message)s", | |
level="INFO") | |
logger = logging.getLogger(__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
# set a base image that includes Lambda Runtime API: | |
# Source: https://hub.docker.com/r/amazon/aws-lambda-python | |
FROM amazon/aws-lambda-python:3.8 | |
# optional: ensure that pip is up to date | |
RUN /var/lang/bin/python3.8 -m pip install --upgrade pip | |
# first we COPY only requirements.txt to ensure that later builds | |
# with changes to your src code will be faster due to caching of this layer | |
COPY 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
from airflow.models import DagModel, TaskInstance, DagRun | |
from airflow.utils.decorators import apply_defaults | |
from airflow.operators.dagrun_operator import TriggerDagRunOperator | |
from airflow.sensors.base_sensor_operator import BaseSensorOperator | |
from airflow.utils.db import provide_session | |
class WaitForCompletion(BaseSensorOperator): | |
""" | |
Waits for a different DAG or a task in a different DAG to complete |
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
import json | |
import logging | |
import requests | |
import pandas as pd | |
import awswrangler as wr | |
from typing import List, Any | |
class DataQualityAlert: | |
def __init__(self, slack_webhook_url: str, database: str = "ecommerce"): |
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
import boto3 | |
import uuid | |
import json | |
import random | |
import logging | |
from datetime import datetime | |
logging.basicConfig(format="[%(levelname)s] [%(name)s] [%(asctime)s]: %(message)s", | |
level="INFO") | |
logger = logging.getLogger(__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
import requests | |
import boto3 | |
import uuid | |
import time | |
import json | |
client = boto3.client('kinesis', region_name='eu-central-1') | |
partition_key = str(uuid.uuid4()) | |
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
# set a base image: https://hub.docker.com/_/python?tab=tags&page=1&ordering=last_updated | |
FROM python:3.8 | |
# optional: ensure that pip is up to date | |
RUN pip install --upgrade pip | |
# first we COPY only requirements.txt to ensure that later builds | |
# with changes to your src code will be faster due to caching of this layer | |
COPY requirements.txt . | |
RUN 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
import time | |
import requests | |
import logging | |
import boto3 | |
from botocore.config import Config | |
def send_price_data_to_timestream(write_client): | |
base_url = "https://min-api.cryptocompare.com/data" | |
symbols = "BTC,ETH,REP,DASH" |
NewerOlder