Skip to main content

show_table

SHOW TABLES

We have currently generated a table called book within the bookshop database. To see all of the tables that have been created, use the SHOW TABLES command. The SDK also includes methods for retrieving a list of all tables in the database.

The Python SDK provides a list_tables() method to return a list of tables under the database.

db = client.db(mk)
rst = db.list_tables(table_keyword="", database="bookshop")
for row in rst["tables"]:
print(row)

SHOW CREATE TABLE

If we need to see the precise structure of a table, we may use SHOW CREATE TABLE. For example, you can see the specific structure of the table we created for books in the following example.

The Python SDK provides the function show_create_table to view the specific structure of a table

db = client.db(mk)
rst = db.show_create_table('bookshop', 'book')