Supprimer une table
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Supprimer une table.
En savoir plus
Pour obtenir une documentation détaillée incluant cet exemple de code, consultez la page suivante :
Exemple de code
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","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)."]]