Skip to content

Instantly share code, notes, and snippets.

@bhtucker
bhtucker / upsert.py
Last active February 17, 2025 15:08
A demonstration of Postgres upserts in SQLAlchemy
"""
Upsert gist
Requires at least postgres 9.5 and sqlalchemy 1.1
Initial state:
[]
Initial upsert:
@bhtucker
bhtucker / close_commit_test.py
Last active February 24, 2022 20:00
Psycopg2 context manager demo: contextmanagers for closing and committing don't play well together without autocommit
import psycopg2
from contextlib import closing
"""
Demonstrate that contextmanagers for closing and committing don't play well together without autocommit
Only the noclosing function can run without error
"""
@bhtucker
bhtucker / prediction_variance.ipynb
Created November 12, 2016 22:21
Demo of some ideas for detecting noisy groups of observations in a multiclass classification setting
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.