Comments (2)
I agree that converting the values back into enums would be a nice feature. I wonder if it should be a default behaviour, or configurable in some way (maybe via the output
clause).
To make the enum comparable to the raw string value you can do this:
# Note - it inherits from `str`
class ReindexStatus(str, Enum):
ready_to_start = 'ready_to_start'
started = 'started'
from piccolo.
I would argue that it should be the default value, since the object()
call is an explicit desire to get the returned object back in a "fully deserialized" form, and Enum casting is part of that. Not sure if it would break for existing users tho.
Thanks for the trick, I'll play with that!
from piccolo.
Related Issues (20)
- Fix `load_json` on joined tables
- Support arrays of timestamp / timestamptz / date / time in SQLite
- cockroachDB extremely long query due to Array(UUID()) HOT 3
- Upgrade CockroachDB
- Is there a way to truncate the table? HOT 3
- Add support for `CAST` to convert between types
- Add more operators to `QueryString`
- Add basic math functions
- Improve array serialisation in `get_sql_value`
- Replace deprecated `@abstractproperty`
- Add `not_any` method to `Array`
- Add `Concat` function
- Replace deprecated `startup` and `shutdown` events in asgi templates HOT 1
- Document how to achieve a `OneToOneField` in Piccolo
- Use `TableTest` to cut down boiler plate in tests
- Be able to hardcode migrations as fake
- Reverse relations fetching HOT 11
- Fix typo in `Email` docstring
- Fix type warnings in `playground/commands/run.py`
- Add `Album` table to playground
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piccolo.