-
Notifications
You must be signed in to change notification settings - Fork 3
Question about querying #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi. You know I didn't even think about querying :) But you're right it would be very nice feature. There is no bitwise lookups in Django though. I'll think about it for a while. Maybe new special lookups will be good solution for this. |
Bitwise lookups are undesirable from the database's perspective: Not all RDBMS support bitmask index and if your RDBMS does support it you would need to manually add that index. The only thing that works well in an index (It works in BTREE and HASH indexes, BTREE is the default in most RDBMS) is an equal lookup on a bitmasked column, so if your bitmasked column is "1 | 4 | 16" the only filter that allows the usage of an index is 'bitmasked_column = 21'. Make sure you keep this in mind if you intend to filter on bigger sets of data. In my opinion, this project is nice because it neatly adds it to the ORM and the Django admin. I do not want to filter on this field, I just want to get the masks after fetching the data with other filters. |
Django 3 added support for Choices |
Hi there,
Am seriously thinking about using this bitmask field, because it looks neat. :-)
However, would you have examples about building queries against this field, using filter/get in the ORM?
Many thanks!
The text was updated successfully, but these errors were encountered: