Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Streaming data to BQ using Storage Write API not possible

Open
#8,063 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Quiet
Tech stack
google-cloud, php
Domain
api, databases

Research direction

Start with BigQueryStorage/metadata/descriptor_fix.php and samples/V1/BigQueryWriteClient/append_rows.php, then trace how AppendRowsRequest and ProtoData are constructed. Determine whether the sample can clearly show a supported way to send rows without confusing descriptor setup; done means the streaming path and required data format are documented or the blocking behavior is precisely identified.

Written by the indexing model from the issue text.

Description

Environment details
  • OS: Windows/Mac
  • PHP version: 8.2/8.3
  • Package name and version: google/cloud-bigquery-storage v2.1.3
Steps to reproduce

It seems to be impossible write data because of descriptor_fix.php (though it might be solving other issues).

I couldn't find any other way to use AppendRows other than using Proto-stuffs functionality.

The provided sample does not relieve the pain of explaining how data is sent.

There are mentions of fixes and AppendsRows, mainly by @bshaffer , but I could not find any information on how to move forward without using Proto-stuffs.

Code example
// prerequisites
$bigQueryWriteClient = new BigQueryWriteClient();
$parent = 'pathhere';

// setup the structure
$row = new Struct();
$row->setFields([
	'impressions' => (new Value())->setNumberValue(213),
]);
$protoRows = new ProtoRows();
$protoRows->setSerializedRows([$row->serializeToString()]);
// add the data
$protoData = new ProtoData([
	'rows' => $protoRows,
]);
// set the schema, which requires the descriptor
$protoData->setWriterSchema(new ProtoSchema([
	'proto_descriptor' => new \Google\Protobuf\DescriptorProto(),
]));

// create the append rows request
$appendRowsRequest = new AppendRowsRequest([
	'write_stream' => $parent . '/streams/_default',
	'proto_rows' => $protoData
]);

// do the writing
$stream = $bigQueryWriteClient->appendRows();
$stream->write($appendRowsRequest);

// finalize
foreach ($stream->closeWriteAndReadAll() as $element) {
	printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
Dominant language
PHP
Stars
1.2k
Forks
464
Avg merge
2d 2h
Merged PRs (30d)
103

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/google-cloud-php

All issues in googleapis/google-cloud-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.