google / cloud-bigquery-storage
PHP Google BigQuery Storage 客户端
v2.0.0
2024-09-07 00:21 UTC
Requires
- php: ^8.0
- google/gax: ^1.34.0
Requires (Dev)
- phpunit/phpunit: ^9.0
Suggests
- ext-grpc: Enables use of gRPC, a universal high-performance RPC framework created by Google.
- ext-protobuf: Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.
- dev-main
- v2.0.0
- v2.0.0-RC1
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.1
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.3.0
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.0
This package is auto-updated.
Last update: 2024-09-07 01:43:18 UTC
README
本组件是 Google BigQuery Storage 的 PHP 风格客户端。
注意: 此存储库是 Google Cloud PHP 的一部分(https://github.com/googleapis/google-cloud-php)。有关支持请求、错误报告或开发贡献,请参阅该项目。
安装
首先,安装 PHP 的首选依赖管理器 Composer。
现在安装此组件
$ composer require google/cloud-bigquery-storage
此组件支持通过 HTTP/1.1 的 REST 和 gRPC。为了利用 gRPC 提供的好处(例如流式方法),请参阅我们的 gRPC 安装指南。
身份验证
请参阅我们的 身份验证指南 了解有关身份验证客户端的更多信息。一旦认证,您就可以开始发送请求。
示例
require 'vendor/autoload.php'; use Google\Cloud\BigQuery\Storage\V1\BigQueryReadClient; use Google\Cloud\BigQuery\Storage\V1\DataFormat; use Google\Cloud\BigQuery\Storage\V1\ReadSession; use Google\Cloud\BigQuery\Storage\V1\ReadSession\TableReadOptions; $client = new BigQueryReadClient(); $project = sprintf( 'projects/%s', '[MY_PROJECT_ID]' ); $table = sprintf( 'projects/%s/datasets/%s/tables/%s', 'bigquery-public-data', 'usa_names', 'usa_1910_current' ); $readOptions = (new TableReadOptions()) ->setRowRestriction('state = "WA"'); $readSession = (new ReadSession()) ->setTable($table) ->setDataFormat(DataFormat::AVRO) ->setReadOptions($readOptions); $session = $client->createReadSession([ 'parent' => $project, 'readSession' => $readSession, 'maxStreamCount' => 1 ]); $stream = $client->readRows([ 'readStream' => $session->getStreams()[0]->getName() ]); foreach ($stream->readAll() as $response) { printf( 'Discovered %s rows in response.' . PHP_EOL, $response->getRowCount() ); }
版本
此组件被认为是 GA(通常可用)。因此,它不会在次要或补丁版本中引入不兼容的更改。我们将优先处理问题和请求。
下一步
- 了解 官方文档。