I am restarting my work on python asyncio foundationdb bindings.
One feedback I get a lot about foundationdb is about how to query the database: “Where is the declarative language”… This is mostly in comparison with SQL databases, even if eventually most people hide the SQL with an API with something like an ORM!
In fact, there is really 6 methods to know about to be able to be productive:
- get (read)
- set (create or update)
- range (read)
- range_startswith (read)
- clear (delete)
- clear_range (delete)
We can add to that
get_key but so far I do not use it.
I want to reduce further the API surface in (my) python asyncio bindings and introduce a
Transaction.query method that will merge the behavior of
range_startswith together, also
clear_range will be a single method.
Here is the signature of
Transaction.query(selector, other=None, limit=None)
In particular if
other.key < selector.key then it means that results should be returned reversed and is equivalent to
tr.range(selector, other, reverse=True)
Also, will make
tuple.strinc public to be able to query by prefix (or add a
prefix keyword argument?)
Similarly, to clear a range or single key there will be:
Case in point: I think this is more explicit how to query since there is a method called
Long story, I struggle with
I will not explain what I do not understand to avoid to add confusion except ask the question:
or_equal == False