) via UDFs. I was also thinking that the "pushdowns" would be hidden from the user and would happen automatically depending on the query.
# creates new accounts table if it doesn't already exist
# adds indexes if they don't already exist
accounts = uv.new("accounts", indexes={"active":bool, "number":int, "name":str, "address.zipcode":str})
# Query for active accounts where the zipcode is '21001' and the median income is > $30k.
active_accounts = accounts.find(D.address.zip == "21001", D.active == True, D.udf(lambda doc: doc.medianincome > 30000))
So basically the 'active' and 'address.zip' columns would be used to query the underlying indexed columns, then the results are iterated over and filtered even more using the UDF for the 'medianincome' column.
However, instead of using a lambda function for the above query you can just use:
But the capability is there for more complex filtering if you need it though UDFs and UDPs.
Also, I believe I can abstract the SQLAlchemy connection interface so that the user can simply specify the connection string in order to access the storage engine. Like so:
uv = Underverse('sqlite:///file.db')
or MySQL:
uv = Underverse('mysql://scott:tiger@localhost/test')
This would allow Underverse access to all the databases that SQLAlchemy can connect to and not just SQLite.
I'd like to avoid changing the API as much as possible while still adding the new functionality. I've spent some time today getting familiar with some of the lower level SQLAlchemy classes and I think I can make it all work together without rewriting too much code.
- Max