Custom Tables
Meya provices a completely extensible database solution using the table
scope. A table
behaves like a collection and provides the same API as users
and flows
.
You can create any number of "tables" to store data. There is no schema, and tables and fields are created dynamically as you write data.
# add rows to two different tables
self.db.table('orders').add({'name': "Nikola", 'sku': "12345", 'price': 102})
self.db.table('cars').add({'model': "Tesla Model 3", 'price': 35000})
# get all orders
self.db.table('cars').all()
# get reasonably priced cars
self.db.table('cars').filter(price__gt=30000, price__lt=100000)
# update the price
self.db.table('cars').update("Oxxxxxx", {'price': 35499})
# overwrite all of the data
self.db.table('cars').update("Oxxxxxx", {'price': 35499, 'model': "Tesla Model 3P"})
# get a specific car
self.db.table('cars').get("Oxxxxxx")
# delete a specific car
self.db.table('cars').delete("Oxxxxxx")
Updated over 5 years ago