Lee una fila parcial
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Lee una fila con un filtro especificado.
Explora más
Para obtener documentación en la que se incluye esta muestra de código, consulta lo siguiente:
Muestra de código
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],[],[],[],null,["Read a row with a specified filter.\n\nExplore further\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Read examples](/bigtable/docs/reading-data)\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 namespace cbt = ::google::cloud::bigtable;\n using ::google::cloud::StatusOr;\n [](google::cloud::bigtable::Table table, std::string const& row_key) {\n StatusOr\u003cstd::pair\u003cbool, cbt::Row\u003e\u003e tuple = table.ReadRow(\n row_key, cbt::Filter::ColumnName(\"stats_summary\", \"os_build\"));\n if (!tuple) throw std::move(tuple).status();\n if (!tuple-\u003efirst) {\n std::cout \u003c\u003c \"Row \" \u003c\u003c row_key \u003c\u003c \" not found\\n\";\n return;\n }\n PrintRow(tuple-\u003esecond);\n }\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\n /// \u003csummary\u003e\n /// /// Reads part of one row from an existing table.\n ///\u003c/summary\u003e\n /// \u003cparam name=\"projectId\"\u003eYour Google Cloud Project ID.\u003c/param\u003e\n /// \u003cparam name=\"instanceId\"\u003eYour Google Cloud Bigtable Instance ID.\u003c/param\u003e\n /// \u003cparam name=\"tableId\"\u003eYour Google Cloud Bigtable table ID.\u003c/param\u003e\n\n public string ReadRowPartial(string projectId = \"YOUR-PROJECT-ID\", string instanceId = \"YOUR-INSTANCE-ID\", string tableId = \"YOUR-TABLE-ID\")\n {\n BigtableClient bigtableClient = BigtableClient.Create();\n TableName tableName = new TableName(projectId, instanceId, tableId);\n string rowkey = \"phone#4c410523#20190501\";\n RowFilter filter = RowFilters.ColumnQualifierExact(\"os_build\");\n Row row = bigtableClient.ReadRow(tableName, rowkey, filter);\n return PrintRow(row);\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 func readRowPartial(w io.Writer, projectID, instanceID string, tableName string) error {\n \t// projectID := \"my-project-id\"\n \t// instanceID := \"my-instance-id\"\n \t// tableName := \"mobile-time-series\"\n\n \tctx := context.Background()\n \tclient, err := bigtable.NewClient(ctx, projectID, instanceID)\n \tif err != nil {\n \t\treturn fmt.Errorf(\"bigtable.NewClient: %w\", err)\n \t}\n \tdefer client.Close()\n\n \ttbl := client.Open(tableName)\n \trowKey := \"phone#4c410523#20190501\"\n \trow, err := tbl.ReadRow(ctx, rowKey, bigtable.RowFilter(bigtable.ColumnFilter(\"os_build\")))\n \tif err != nil {\n \t\treturn fmt.Errorf(\"could not read row with key %s: %w\", rowKey, err)\n \t}\n\n \tprintRow(w, row)\n\n \treturn nil\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 public static void readRowPartial() {\n // TODO(developer): Replace these variables before running the sample.\n String projectId = \"my-project-id\";\n String instanceId = \"my-instance-id\";\n String tableId = \"mobile-time-series\";\n readRowPartial(projectId, instanceId, tableId);\n }\n\n public static void readRowPartial(String projectId, String instanceId, String tableId) {\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. After completing all of your requests, call\n // the \"close\" method on the client to safely clean up any remaining background resources.\n try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) {\n String rowkey = \"phone#4c410523#20190501\";\n Filters.Filter filter =\n FILTERS\n .chain()\n .filter(FILTERS.family().exactMatch(\"stats_summary\"))\n .filter(FILTERS.qualifier().exactMatch(\"os_build\"));\n\n Row row = dataClient.readRow(TableId.of(tableId), rowkey, filter);\n printRow(row);\n\n } catch (IOException e) {\n System.out.println(\n \"Unable to initialize service client, as a network error occurred: \\n\" + e.toString());\n }\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 const COLUMN_FAMILY = 'stats_summary';\n const COLUMN_QUALIFIER = 'os_build';\n const rowkey = 'phone#4c410523#20190501';\n\n const [row] = await table\n .row(rowkey)\n .get([`${COLUMN_FAMILY}:${COLUMN_QUALIFIER}`]);\n\n printRow(rowkey, row);\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 use Google\\Cloud\\Bigtable\\BigtableClient;\n use Google\\Cloud\\Bigtable\\Filter;\n\n /**\n * Read partial row data\n *\n * @param string $projectId The Google Cloud project ID\n * @param string $instanceId The ID of the Bigtable instance\n * @param string $tableId The ID of the table to read from\n */\n function read_row_partial(\n string $projectId,\n string $instanceId,\n string $tableId\n ): void {\n // Connect to an existing table with an existing instance.\n $dataClient = new BigtableClient([\n 'projectId' =\u003e $projectId,\n ]);\n $table = $dataClient-\u003etable($instanceId, $tableId);\n\n $rowkey = 'phone#4c410523#20190501';\n $rowFilter = Filter::qualifier()-\u003eregex('os_build');\n $row = $table-\u003ereadRow($rowkey, ['filter' =\u003e $rowFilter]);\n\n print_row($rowkey, $row);\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 def read_row_partial(project_id, instance_id, table_id):\n from google.cloud import https://cloud.google.com/python/docs/reference/bigtable/latest/\n from google.cloud.bigtable import row_filters\n\n client = https://cloud.google.com/python/docs/reference/bigtable/latest/.https://cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.client.Client.html(project=project_id, admin=True)\n instance = https://cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.client.html.https://cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.client.Client.html#google_cloud_bigtable_client_Client_instance(instance_id)\n table = instance.table(table_id)\n\n row_key = \"phone#4c410523#20190501\"\n col_filter = row_filters.ColumnQualifierRegexFilter(b\"os_build\")\n\n row = table.read_row(row_key, filter_=col_filter)\n print_row(row)\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 # instance_id = \"my-instance\"\n # table_id = \"my-table\"\n bigtable = Google::Cloud::https://cloud.google.com/ruby/docs/reference/google-cloud-bigtable-admin-v2/latest/Google-Cloud-Bigtable.html.https://cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable.html\n table = bigtable.table instance_id, table_id\n filter = Google::Cloud::https://cloud.google.com/ruby/docs/reference/google-cloud-bigtable-admin-v2/latest/Google-Cloud-Bigtable.html::https://cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-RowFilter.html.qualifier \"os_build\"\n\n row = table.https://cloud.google.com/ruby/docs/reference/google-cloud-bigtable/latest/Google-Cloud-Bigtable-ReadOperations.html \"phone#4c410523#20190501\", filter: filter\n print_row row\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=bigtable)."]]