Eliminazione di una tabella
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Eliminare una tabella.
Per saperne di più
Per la documentazione dettagliata che include questo esempio di codice, vedi quanto segue:
Esempio di codice
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","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)."]]