dynadb.table()

Read(2128) Label: create, delete, dynamodb,

Description:

Create or delete a Dynamodb table.

Syntax:

dynadb.table(tableName,partitonKey,type1,sortKey,type2)

dynadb.table@d(tableName)

Note:

External library function (See External Library Guide).

 

Parameter tableName and parameter partitionKey should be present at creation; return the table name if the creation succeeds and return false if the creation fails. The deletion operation only needs option @d and parameter tableName and returns a Boolean value.

Parameter:

tableName

Table name

partitionKey

The main partition key

type1/type2

Data types S, N and B, which represent string, number and binary respectively; default type is S; when type2 is present, type1 cannot be omitted

sortKey

The sorting key, which can be omitted at table creation

Option:

@d

Perform table deletion

Return value:

Boolean value/String

Example:

 

A

 

1

=dyna_open("http://localhost:8000", "us-east-2")

 

2

=A1.table("emp1","pid")

Create emp1 table, where the main partition key is pid and date type is S.

3

=A1.table("emp2","pid","N")

Create emp2 table, where the main partition key is pid and date type is N.

4

=A1.table("emp3","pid","fname")

Create emp3 table, where the main partition key is pid, sorting key is fname and date type is S.

5

=A1.table("emp4", "pid","N","fname")

Create emp4 table, where the data type of pid is N and that of fname is S.

6

=A1.table("emp5","pid","fname","S")

Creation of emp5 fails; pid’s data type cannot be omitted when setting data type for fname.

7

=A1.table("emp6","pid","N","fname","S")

Create emp6 table, where the data type of pid is N and that of fname is S.

8

=A1.table@d("dept")

Delete dept table.

9

>A1.close()