Closed wuichen closed 6 years ago
Hi @wuichen, you don't need to call createTables
on every call. If you can "guarantee" that the table is there and accessible by the Lambda function then you can just interact with it using query
, scan
, etc as needed.
@clarkie are there any examples showing how to do simple create without createTable?
Something like this?
const schema = {
id: joi.string(),
name: joi.string(),
};
const userTable = dynogels.define('user', {
hashKey: 'id',
timestamps: true,
schema,
});
function create(user) {
const id = uuid.v4();
return userTable
.createAsync(Object.assign({ id }, user))
.then(console.log);
}
do i have to call createtable everytime when i want to do create an item in an existing table? If not, how to do so? The only operation i need is CRUD on existing tables. im working on lambda functions.