删除表
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
删除表。
深入探索
如需查看包含此代码示例的详细文档,请参阅以下内容:
代码示例
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis page provides code samples demonstrating how to delete a table in Bigtable using various programming languages.\u003c/p\u003e\n"],["\u003cp\u003eThe code samples are available in C++, C#, Go, Java, Node.js, PHP, Python, and Ruby, each illustrating the deletion process within its respective language.\u003c/p\u003e\n"],["\u003cp\u003eTo use these code samples, it's necessary to set up Application Default Credentials for authentication, as outlined in the documentation.\u003c/p\u003e\n"],["\u003cp\u003eThe page references resources for installing Bigtable client libraries and explores other code samples in the Google Cloud sample browser.\u003c/p\u003e\n"]]],[],null,["Delete a table.\n\nExplore further\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [C# hello world](/bigtable/docs/samples-c-sharp-hello)\n- [C++ hello world](/bigtable/docs/samples-cpp-hello)\n- [Go hello world](/bigtable/docs/samples-go-hello)\n- [Java hello world](/bigtable/docs/samples-java-hello-world)\n- [Node.js hello world](/bigtable/docs/samples-nodejs-hello)\n- [PHP hello world](/bigtable/docs/samples-php-hello)\n- [Python hello world](/bigtable/docs/samples-python-hello)\n- [Ruby hello world](/bigtable/docs/samples-ruby-hello)\n\nCode sample \n\nC++\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n google::cloud::Status status = table_admin.DeleteTable(table.table_name());\n if (!status.ok()) throw std::runtime_error(status.message());\n\nC#\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n // Clean up. Delete the table.\n Console.WriteLine($\"Delete table: {tableId}\");\n\n bigtableTableAdminClient.DeleteTable(name: tableName);\n if (!TableExist(bigtableTableAdminClient))\n {\n Console.WriteLine($\"Table: {tableId} deleted successfully\");\n }\n\nGo\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n log.Printf(\"Deleting the table\")\n if err = adminClient.DeleteTable(ctx, tableName); err != nil {\n \tlog.Fatalf(\"Could not delete table %s: %v\", tableName, err)\n }\n\n if err = adminClient.Close(); err != nil {\n \tlog.Fatalf(\"Could not close admin client: %v\", err)\n }\n\nJava\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n System.out.println(\"\\nDeleting table: \" + tableId);\n try {\n adminClient.deleteTable(tableId);\n System.out.printf(\"Table %s deleted successfully%n\", tableId);\n } catch (NotFoundException e) {\n System.err.println(\"Failed to delete a non-existent table: \" + e.getMessage());\n }\n\nNode.js\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n console.log('Delete the table');\n await table.delete();\n\nPHP\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n try {\n printf('Attempting to delete table %s.' . PHP_EOL, $tableId);\n $deleteTableRequest = (new DeleteTableRequest())\n -\u003esetName($tableName);\n $tableAdminClient-\u003edeleteTable($deleteTableRequest);\n printf('Deleted %s table.' . PHP_EOL, $tableId);\n } catch (ApiException $e) {\n if ($e-\u003egetStatus() === 'NOT_FOUND') {\n printf('Table %s does not exists' . PHP_EOL, $tableId);\n } else {\n throw $e;\n }\n }\n\nPython\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n print(\"Deleting the {} table.\".format(table_id))\n table.delete()\n\nRuby\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n puts \"Deleting the table #{table_id}\"\n # Call the admin API to delete the table given its full resource path.\n table_client.delete_table name: table_name\n\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=bigtable)."]]