Views¶
Views are named, reusable query patterns stored within the bundle. They automatically inherit changes from their parent container -- when you add new data to the parent, views see it on next open.
Creating a View¶
Create a view by providing a name and a SQL query.
Opening a View¶
Note
Views are read-only. You cannot call transformation methods like filter() or attach() on a view.
Drop View¶
Remove a view from the bundle.
Rename View¶
Rename an existing view.
Dynamic Inheritance¶
Views automatically see new data added to the parent container:
bundle = await bb.create("my/data")
await bundle.attach("customers-1.csv")
await bundle.commit("v1")
await bundle.create_view("active", sql="SELECT * FROM bundle WHERE status = 'active'")
await bundle.commit("v2")
# Later, add more data
await bundle.attach("customers-2.csv")
await bundle.commit("v3")
# View now sees both data files
view = await bundle.view("active")
bundle = bb.create("my/data")
bundle.attach("customers-1.csv")
bundle.commit("v1")
bundle.create_view("active", sql="SELECT * FROM bundle WHERE status = 'active'")
bundle.commit("v2")
# Later, add more data
bundle.attach("customers-2.csv")
bundle.commit("v3")
# View now sees both data files
view = bundle.view("active")