Do you want:
- Faster searching of Data Tables?
- More predictable performance?
- Fewer round-trips to the server when displaying linked rows?
- Control over which columns to fetch from which tables?
Good news – we have just completed a full rewrite of the Data Tables back-end, bringing all of these and more, and we’re launching it as a beta today. This does not change the existing Data Tables API – it will just make your apps faster and smoother! (We’ve also added some extra functionality, and we’ll be adding more - scroll down for details.)
To opt into this beta, open the Data Tables section of the Beta Editor configuration:
Check the box, then run your app! Nothing should change, apart from your database access getting faster
NB: This flag is stored as part of your source code, so it’s safe to enable it in the development version of your app, without affecting the functioning of the rest of your app until you deploy that change to production. The format of the database itself hasn’t changed, so you can flip back and forth.
We’re looking for feedback. Obviously, please tell us if anything goes wrong – but also let us know what performance impact you see
Advanced feature: Partial fetches
If you want to gain better control of your searches, and retrieve less data, use the new
fetch_only search modifier to choose only certain columns to cache.
from anvil.tables import query as q # Get rows from the "users" table, only fetching the "email" and # "enabled" columns: rows = app_tables.users.search(q.fetch_only("email", "enabled"))
This will return partially-cached Row objects: If you touch any other columns in that row, you will incur a round-trip to the server while the rest of the data is fetched.
You can even control fetching of linked data, eg:
# Get rows from the "users" table, following the linked "group" # column but only caching the "name" column of the linked rows. rows = app_tables.users.search(q.fetch_only("email",group=q.fetch_only("name")))
You can also pass
fetch_only to the
For more information, check out the documentation: