3 ms·
Coherent Python and PostgreSQL Enums Using SQLAlchemy
- avikej 5y agoNice read! I've found it to be tricky to maintain definition consistencies between Python/SQLAlchemy, so this will definitely come in handy :D
- code4you 5y agoVery useful - I've had bugs due to incorrect strings entering enum like values the database and I imagine using db-checked enums like this would have saved me some huge headaches
- threadthread 5y agoGetting a database to line up with production code is especially important in python as pep 484 types become more commonplace. If you trust the type annotations but the database/orm is polluting data structures with values that don’t conform to the annotations, you’ve lost a lot of the annotation work’s leverage.