Leer por claves

Leer con un conjunto no contiguo de claves de fila.

Investigar más

Para obtener documentación detallada que incluya este código de muestra, consulta lo siguiente:

Código de ejemplo

Go

Para saber cómo instalar y usar la biblioteca de cliente de Bigtable, consulta el artículo Bibliotecas de cliente de Bigtable.

Para autenticarte en Bigtable, configura las credenciales predeterminadas de la aplicación. Para obtener más información, consulta el artículo Configurar la autenticación en un entorno de desarrollo local.

log.Printf("Getting a single greeting by row key:")
row, err := tbl.ReadRow(ctx, rowKeys[0], bigtable.RowFilter(bigtable.ColumnFilter(columnName)))
if err != nil {
	log.Fatalf("Could not read row with key %s: %v", rowKeys[0], err)
}
log.Printf("\t%s = %s\n", rowKeys[0], string(row[columnFamilyName][0].Value))

Java

Para saber cómo instalar y usar la biblioteca de cliente de Bigtable, consulta el artículo Bibliotecas de cliente de Bigtable.

Para autenticarte en Bigtable, configura las credenciales predeterminadas de la aplicación. Para obtener más información, consulta el artículo Configurar la autenticación en un entorno de desarrollo local.

try {
  System.out.println("\nReading a single row by row key");
  Row row = dataClient.readRow(TableId.of(tableId), ROW_KEY_PREFIX + 0);
  System.out.println("Row: " + row.getKey().toStringUtf8());
  for (RowCell cell : row.getCells()) {
    System.out.printf(
        "Family: %s    Qualifier: %s    Value: %s%n",
        cell.getFamily(), cell.getQualifier().toStringUtf8(), cell.getValue().toStringUtf8());
  }
  return row;
} catch (NotFoundException e) {
  System.err.println("Failed to read from a non-existent table: " + e.getMessage());
  return null;
}
try {
  System.out.println("\nReading specific cells by family and qualifier");
  Row row = dataClient.readRow(TableId.of(tableId), ROW_KEY_PREFIX + 0);
  System.out.println("Row: " + row.getKey().toStringUtf8());
  List<RowCell> cells = row.getCells(COLUMN_FAMILY, COLUMN_QUALIFIER_NAME);
  for (RowCell cell : cells) {
    System.out.printf(
        "Family: %s    Qualifier: %s    Value: %s%n",
        cell.getFamily(), cell.getQualifier().toStringUtf8(), cell.getValue().toStringUtf8());
  }
  return cells;
} catch (NotFoundException e) {
  System.err.println("Failed to read from a non-existent table: " + e.getMessage());
  return null;
}

Python

Para saber cómo instalar y usar la biblioteca de cliente de Bigtable, consulta el artículo Bibliotecas de cliente de Bigtable.

Para autenticarte en Bigtable, configura las credenciales predeterminadas de la aplicación. Para obtener más información, consulta el artículo Configurar la autenticación en un entorno de desarrollo local.

print("Getting a single greeting by row key.")
key = "greeting0".encode()

row = table.read_row(key, row_filter)
cell = row.cells[column_family_id][column][0]
print(cell.value.decode("utf-8"))

Siguientes pasos

Para buscar y filtrar ejemplos de código de otros Google Cloud productos, consulta el Google Cloud navegador de ejemplos.