dynadb.table()

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

Description:

Create or delete a Dynamodb table.

Syntax:

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

dynadb.table@d(tableName)

Note:

The external library function creates or deletes a Dynamodb data table. Parameter tableName and parameter partitionKey should be present at creation, and the deletion operation only needs option @d and parameter tableName.

Parameters:

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

Options:

@d

Perform table deletion

Return value:

A Boolean value

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")

Delet dept table

9

>A1.close()