Skip to content

Instantly share code, notes, and snippets.

View alespouzar's full-sized avatar

Aleš Pouzar alespouzar

View GitHub Profile
@alespouzar
alespouzar / example.py
Created June 16, 2020 15:06 — forked from sbealer/example.py
Ship a compressed (gzip) csv to S3. Write to your compressed file with csv writer in one step. Python 3
import io
import gzip
import csv
import boto3
import os
destination_bucket = 'your-directory'
destination_directory = 'your/directory/'
destination_filename = 'text.csv.gz'
@alespouzar
alespouzar / sf-workaround.sql
Last active January 20, 2017 18:17
Snowflake workaround for missing WINDOW FRAME in LAST_VALUE function
CREATE OR REPLACE TABLE "test" ("id" INTEGER, "text" VARCHAR);
INSERT INTO "test" ("id", "text") VALUES (1, 'first'), (2, 'second'), (3, NULL),
(4, NULL), (5, 'fifth'), (6, NULL), (7, NULL), (8, NULL), (9, 'ninth');
SELECT * FROM "test" ORDER BY "id";
SELECT "id",
FIRST_VALUE("text") OVER (PARTITION BY "grp" ORDER BY "id") AS "text"
FROM
(
SELECT