Create the ability for a table to auto-increment the hash_attribute (primary key)
When a create_table operation is executed add an extra optional attribute called auto_increment. This attribute would dictate the hash attribute is 1. numeric & 2 will always autoincrement itself & ignore any values passed for the hash attribute on insert.
The default for this value is false if not supplied.
sample call:
{
"operation":"create_table",
"schema":"dev",
"table":"sensor",
"hash_attribute":"id",
"autoincrement":true
}
Comments: 1
-
02 Feb, '21
Safa AlaiWhy not expand this to auto-increment any field on insert. As such it would use the auto-increment field in the create_attribute operation to specify a field is an integer auto-increment field.
But if you wish to generalize even further, then on create_attribute, user could specify a formula as a lambda function to show how a field is assigned a value on insert.
Sample call:
{
"operation":"create_attribute",
"schema":"dev",
"table":"dog",
"attribute":"xyz",
"on_insert":"(prev-xyz-value) => fn(prev-xyz-value)"
}
]