Description:
Execute a calculation on data in a DynamoDB table.
Syntax:
dynadb.execute(sql)
dynadb.execute (A,sql)
Note:
The external library function (See External Library Guide) executes insert, modification and delete operations on a DynamoDB table.
It allows batch insert, but needs to specify the fields to which data is inserted at execution because DynamoDB stores data in the structure of key:value.
Parameter:
sql |
A sql statement |
A |
A sequence on which the sql statement is executed circularly while calculating different parameter values to pass to sql for execution |
Return value:
Boolean value
Example:
|
A |
|
1 |
=dyna_open("http://localhost:8000", "us-east-2") |
|
2 |
=A1.execute( "INSERT into emp(pid, fname, lname, birthday, gender) values (106, 'Bob', 'Jom', '2004-04-03', 'F')") |
Insert data. |
3 |
=A1.execute( "INSERT into emp(pid, fname, lname, birthday, gender) values (?,?,?,?,?) ", 107, "Emma", "Lee", "2002-12-10", "M") |
Insert data. |
4 |
=A1.execute( "INSERT into emp(pid, fname, lname, birthday, gender) values (108, ?) ", [ "Biber", "Johnson", "2005-06-20", "F"]) |
Auto-align key and value when there are multiple parameters. |
5 |
=[[109, "Maricela", "Jones", "2012-10-09", "M"],[110, "Benjamin","Davis", "2010-10-10", "F"]].new(~(1):PID,~(2): fname, ~(3): lname, ~(4): birthday, ~(5): gender ) |
Generate a table sequence. |
6 |
=A1.execute(A5, "INSERT into emp(pid, fname, lname, birthday, gender) values (?) ", #1,#2,#3,#4,#5) |
Insert data in A5’s table sequence to A1’s table. |
7 |
=file("D:// esproc/esProc/demo/empinfo.txt").cursor@qtc() |
|
8 |
=A1.execute(A7,"INSERT into emp(pid,fname,lname,birthday,gender) values (?)",#1,#2,#3,#4,#5) |
Insert data in A7’s cursor to A1’s table |
9 |
=A1.execute("update emp set lname='William ' where pid=108 and fname=' Biber '") |
Update data. |
10 |
=A1.execute("delete from emp where pid=106 and fname='Bob'") |
Delete data. |
11 |
>A1.close() |
|