Skip to content

Instantly share code, notes, and snippets.

View GarrettMooney's full-sized avatar

Garrett Mooney GarrettMooney

View GitHub Profile
@GarrettMooney
GarrettMooney / etl.py
Last active September 30, 2024 21:11
Query athena, return a polars dataframe, subquery via duckdb
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "duckdb",
# "polars",
# "pyarrow",
# "pyathena",
# "s3fs",
# ]
# ///
@GarrettMooney
GarrettMooney / create_sagemaker_endpoint.py
Created October 7, 2024 15:29
Create sagemaker endpoint from local artifact and inference.py
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "boto3",
# "sagemaker",
# ]
# ///
import subprocess
import time
from time import gmtime, strftime
@GarrettMooney
GarrettMooney / ui.py
Created October 8, 2024 19:57
Streamlit chatbot template
import uuid
import streamlit as st
#########
# Helpers
#########
def get_completion(question, session_id):
@GarrettMooney
GarrettMooney / queries.md
Last active October 29, 2024 23:57
Useful snowflake queries

Schemas in QA but not in Prod

WITH qa AS (
    SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
    FROM qa_edw_pstg.information_schema.tables
),
prod AS (
    SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME
    FROM prd_edw_pstg.information_schema.tables
@GarrettMooney
GarrettMooney / build.sh
Created February 11, 2025 17:36
Install geo_polars plugin from python polars book
#!/usr/bin/env bash
# install rustup if it doesn't exist
if ! command -v rustup &> /dev/null
then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
# install uv if it doesn't exist
if ! command -v uv &> /dev/null
@GarrettMooney
GarrettMooney / CLAUDE.md
Created October 2, 2025 05:02
local CLAUDE.md

Functional Programming in Python

Preferences

  • duckdb when data processing can easily be expressed in sql
  • polars over pandas
  • simple functions over classes
  • inline dependencies in python scripts
  • uv and uvx for package management, python clis, scripts, and virtual environments