Add option create record faster

(Oscar Alvarez) #1


When it create a record this return a instance object, this process is fine (it could be slow), but sometimes we need only that returns the ids of new records not all instance object for example for to create hundred/thousands of records in batch process, maybe would be a faster transaction and less works in server.


Add a new method for to create or add to create method an attribute for return only ids.


Add new method ModelStorage.create_with_ids(values)
add new attribute to ModelStorage.create(values, return_ids=True/False)

(albert) #2

Have you measured the overhead of creating the objects? I’m curious to know how much time it takes to instantiate them.

(Oscar Alvarez) #3

Not yet, but I will try do it and post the results