Live Chat

We'll need to share your messages (and your email address if you're logged in) with our live chat provider, Drift. Here's their privacy policy.

If you don't want to do this, you can email us instead at contact@anvil.works.

Data Tables now have a rich query language
« Anvil Blog

We’ve just upgraded Anvil to make data storage much more powerful.

Data Tables already give you a Python-based system for storing and retrieving data. There’s also a graphical interface to make designing databases even quicker.

This upgrade gives you a library of query operators. You pass them to the search() method when you access your data.

To get all restaurants rated higher than 2 stars:

app_tables.restaurants.search(
  rating=q.greater_than(2)
)

To get all menu items that include the string ‘pizza’:

app_tables.menu.search(
  dish_name=q.ilike('%pizza%')
)

To perform an intelligent search within natural language text:

app_tables.reviews.search(
  review_text=q.full_text_match('Easy to find')
)

You can combine query operators together to build complex queries when you need them. To find good restaurants in London, or any outside of London:

app_tables.restaurants.search(
  q.any_of(
    location=q.not_('London'),
    rating=q.greater_than(2),
  )
)

It’s live right now. Copy an example app to your account and try out some queries of your own. To find out more, have a look at the tutorial.

Whatever you’re building right now, we hope this helps you make it even better.



Learn More

Get the best out of Anvil with our free email course.