What is the best way to check if table exists in DynamoDB?

后端 未结 6 2124
粉色の甜心
粉色の甜心 2021-02-19 22:28

What is the best way to check if table exists in DynamoDb?

I would appreciate it if the code would be in PHP.

Either active or not.

* Added late

6条回答
  •  [愿得一人]
    2021-02-19 22:34

    The above answers are correct if you just want to know whether the table exist or not. I want to make another helpful point here in case.

    One should be very careful in multi-threaded or production level code.

    Assuming that one thread deleted the table, then you will still get the answer that the table exists in answer to your query from second thread, until the table is fully deleted. In such case, once the table is deleted, the table handle in second thread is zombie, like the dangling pointer error in C++.

提交回复
热议问题