데이터 세트 및 데이터 세트의 콘텐츠 삭제
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
프로젝트에서 데이터 세트 및 데이터 세트의 콘텐츠를 삭제합니다.
코드 샘플
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 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 content provides instructions and code samples for deleting a BigQuery dataset and its contents.\u003c/p\u003e\n"],["\u003cp\u003eThe code samples are available in C#, Java, and Ruby, demonstrating how to delete datasets using the respective BigQuery client libraries.\u003c/p\u003e\n"],["\u003cp\u003eEach code sample utilizes a specific method or parameter (like \u003ccode\u003eDeleteDatasetOptions\u003c/code\u003e in C# and \u003ccode\u003edeleteContents()\u003c/code\u003e in Java) to ensure that both the dataset and its content are removed.\u003c/p\u003e\n"],["\u003cp\u003eTo successfully use the provided samples, users need to set up authentication for client libraries and follow the BigQuery quickstart guides.\u003c/p\u003e\n"],["\u003cp\u003eThe page also directs users to the Google Cloud sample browser to find code samples for other Google Cloud products.\u003c/p\u003e\n"]]],[],null,["Delete a dataset and its contents from a project.\n\nCode sample \n\nC#\n\n\nBefore trying this sample, follow the C# setup instructions in the\n[BigQuery quickstart using\nclient libraries](/bigquery/docs/quickstarts/quickstart-client-libraries).\n\n\nFor more information, see the\n[BigQuery C# API\nreference documentation](/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest).\n\n\nTo authenticate to BigQuery, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for client libraries](/bigquery/docs/authentication#client-libs).\n\n\n using https://cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.html;\n using System;\n\n public class BigQueryDeleteDatasetAndContents\n {\n public void DeleteDatasetAndContents(\n string projectId = \"your-project-id\",\n string datasetId = \"your_dataset_with_tables\"\n )\n {\n https://cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient.html client = https://cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient.html.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient.html#Google_Cloud_BigQuery_V2_BigQueryClient_Create_System_String_Google_Apis_Auth_OAuth2_GoogleCredential_(projectId);\n // Use the DeleteDatasetOptions to delete a dataset and its contents\n client.https://cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.BigQueryClient.html#Google_Cloud_BigQuery_V2_BigQueryClient_DeleteDataset_Google_Apis_Bigquery_v2_Data_DatasetReference_Google_Cloud_BigQuery_V2_DeleteDatasetOptions_(\n datasetId: datasetId,\n options: new https://cloud.google.com/dotnet/docs/reference/Google.Cloud.BigQuery.V2/latest/Google.Cloud.BigQuery.V2.DeleteDatasetOptions.html() { DeleteContents = true }\n );\n Console.WriteLine($\"Dataset {datasetId} and contents deleted.\");\n }\n }\n\nJava\n\n\nBefore trying this sample, follow the Java setup instructions in the\n[BigQuery quickstart using\nclient libraries](/bigquery/docs/quickstarts/quickstart-client-libraries).\n\n\nFor more information, see the\n[BigQuery Java API\nreference documentation](/java/docs/reference/google-cloud-bigquery/latest/overview).\n\n\nTo authenticate to BigQuery, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for client libraries](/bigquery/docs/authentication#client-libs).\n\n import com.google.cloud.bigquery.https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQuery.html;\n import com.google.cloud.bigquery.https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQueryException.html;\n import com.google.cloud.bigquery.https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQueryOptions.html;\n import com.google.cloud.bigquery.https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.DatasetId.html;\n\n // Sample to delete dataset with contents.\n public class DeleteDatasetAndContents {\n\n public static void main(String[] args) {\n // TODO(developer): Replace these variables before running the sample.\n String projectId = \"MY_PROJECT_ID\";\n String datasetName = \"MY_DATASET_NAME\";\n deleteDatasetAndContents(projectId, datasetName);\n }\n\n public static void deleteDatasetAndContents(String projectId, String datasetName) {\n try {\n // Initialize client that will be used to send requests. This client only needs to be created\n // once, and can be reused for multiple requests.\n https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQuery.html bigquery = https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQueryOptions.html.getDefaultInstance().getService();\n\n https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.DatasetId.html datasetId = https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.DatasetId.html.of(projectId, datasetName);\n // Use the force parameter to delete a dataset and its contents\n boolean success = bigquery.https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQuery.html#com_google_cloud_bigquery_BigQuery_delete_com_google_cloud_bigquery_DatasetId_com_google_cloud_bigquery_BigQuery_DatasetDeleteOption____(datasetId, BigQuery.DatasetDeleteOption.https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQuery.html#com_google_cloud_bigquery_BigQuery_delete_com_google_cloud_bigquery_DatasetId_com_google_cloud_bigquery_BigQuery_DatasetDeleteOption____Contents());\n if (success) {\n System.out.println(\"Dataset deleted with contents successfully\");\n } else {\n System.out.println(\"Dataset was not found\");\n }\n } catch (https://cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.BigQueryException.html e) {\n System.out.println(\"Dataset was not deleted with contents. \\n\" + e.toString());\n }\n }\n }\n\nRuby\n\n\nBefore trying this sample, follow the Ruby setup instructions in the\n[BigQuery quickstart using\nclient libraries](/bigquery/docs/quickstarts/quickstart-client-libraries).\n\n\nFor more information, see the\n[BigQuery Ruby API\nreference documentation](https://googleapis.dev/ruby/google-cloud-bigquery/latest/Google/Cloud/Bigquery.html).\n\n\nTo authenticate to BigQuery, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for client libraries](/bigquery/docs/authentication#client-libs).\n\n require \"google/cloud/bigquery\"\n\n def delete_dataset_and_contents dataset_id = \"my_dataset_with_tables\"\n bigquery = Google::Cloud::https://cloud.google.com/ruby/docs/reference/google-cloud-bigquery-storage/latest/Google-Cloud-Bigquery.html.https://cloud.google.com/ruby/docs/reference/google-cloud-bigquery/latest/Google-Cloud-Bigquery.html\n\n # Use the force parameter to delete a dataset and its contents\n dataset = bigquery.dataset dataset_id\n dataset.delete force: true\n puts \"Dataset #{dataset_id} and contents deleted.\"\n end\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=bigquery)."]]