Closed thelittlebug closed 6 years ago
Thanks for this feature addition. There's the overall question if dataset should support more of SQLAlchemy's features (and which) and how to expose them elegantly. I'm not 100% sure about the dictionary syntax. Django's ORM comes with comparisons in the style of age__gte=42
, but that would need more code to replicate, so I'd rather have this simple solution.
@stefanw the reason i am pushing this is simple: https://github.com/pudo/dataset/issues/213#issuecomment-396721435
@stefanw I feel like we've been waiting for years now to make more complex queries, and this looks like a fairly nice and transparent implementation. Do you think it'd be good to plan out a bigger set of operators before diving in, or that it's OK to just merge this one and then see what's next?
Well, planning out operators would mean dataset is not only "databases for lazy people" but getting closer to the point where dataset will be to SQLAlchemy what requests is to urllib. I don't think we have the dedication or the experience to really deliver on that front.
The syntax here is OK, but extending it much further could become awkward fast. Possibly we should offer easier ways into raw SQL, e.g. for WHERE clauses something like table.where("name @@ to_tsquery('püdö')")
. Just to remind people that dataset is convenient for one-off scripts & scrapers, but it's not a general purpose SQL abstraction layer and definitely not an ORM.
You may do the merging honour.
bump... :)
i hope everything is correct. this is my first pr on github
i addded some more operators, updated the docs and wrote some tests.
gl & hf :)