wojcikstefan
Joined 14 years ago
Joined 14 years ago
I strongly disagree – as a person who's eaten vegan for over a year, tried all the fancy meat alternatives, and has gone back because a good grass-fed steak is just 10x more delicious.
https://www.postgresql.org/docs/current/ddl-partitioning.htm...
I haven't yet used it in production, but I would've expected that a system which evolved out of Uber's Cadence [0] (and which I believe is used at Uber extensively) would've scaled very well.
> Is this behaviour new?
Don't think so. Even the docs for SQLA v1.3 ([0]) mention it:
> native_enum – Use the database’s native ENUM type when available. Defaults to True. When False, uses VARCHAR + check constraint for all backends. The VARCHAR length can be controlled with Enum.length
[0]: https://docs.sqlalchemy.org/en/13/core/type_basics.html#sqla...
--
> Or is it that alembic still doesn't pick up changes to the enum to recreate the constraint?
Off the top of my head, I believe Alembic doesn't pick it up automatically. We make a lot of manual tweaks to our auto-generated Alembic migrations and I believe adding / modifying the CHECK constrains is part of it.
> It's such an outrageously naive idea that I'm sure most people here were attracted to the title thinking it's about algebraic types or some other similar misunderstanding.
Just to share how we at Close got into this discussion (which I personally don't find as "outrageous" as you), SQLAlchemy – which we use in our Python code – uses `native_enum=True` as the default value for its `Enum` type [0], which then translates to using types in PostgreSQL:
> native_enum – Use the database’s native ENUM type when available. Defaults to True. When False, uses VARCHAR + check constraint for all backends.
[0]: https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqla...
Does this approach ensure data consistency? Or could you accidentally insert a number value into your table which is not represented by any of the enum values?
Right?
https://twitter.com/wojcikstefan https://github.com/wojcikstefan