ahmedabu98 commented on code in PR #33044:
URL: https://github.com/apache/beam/pull/33044#discussion_r1836749162
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerReadSchemaTransformProvider.java:
##########
@@ -54,43 +55,81 @@
*
* <p>The transformation leverages the {@link SpannerIO} to perform the read
operation and maps the
* results to Beam rows, preserving the schema.
- *
- * <p>Example usage in a YAML pipeline using query:
- *
- * <pre>{@code
- * pipeline:
- * transforms:
- * - type: ReadFromSpanner
- * name: ReadShipments
- * # Columns: shipment_id, customer_id, shipment_date, shipment_cost,
customer_name, customer_email
- * config:
- * project_id: 'apache-beam-testing'
- * instance_id: 'shipment-test'
- * database_id: 'shipment'
- * query: 'SELECT * FROM shipments'
- * }</pre>
- *
- * <p>Example usage in a YAML pipeline using a table and columns:
- *
- * <pre>{@code
- * pipeline:
- * transforms:
- * - type: ReadFromSpanner
- * name: ReadShipments
- * # Columns: shipment_id, customer_id, shipment_date, shipment_cost,
customer_name, customer_email
- * config:
- * project_id: 'apache-beam-testing'
- * instance_id: 'shipment-test'
- * database_id: 'shipment'
- * table: 'shipments'
- * columns: ['customer_id', 'customer_name']
- * }</pre>
*/
@AutoService(SchemaTransformProvider.class)
public class SpannerReadSchemaTransformProvider
extends TypedSchemaTransformProvider<
SpannerReadSchemaTransformProvider.SpannerReadSchemaTransformConfiguration> {
+ @Override
+ public String identifier() {
+ return "beam:schematransform:org.apache.beam:spanner_read:v1";
+ }
+
+ @Override
+ public String description() {
+ return "Performs a Bulk read from Google Cloud Spanner using a specified
SQL query or "
+ + "by directly accessing a single table and its columns.\n"
+ + "\n"
+ + "Both Query and Read APIs are supported. See more information about "
+ + "<a href=\"https://cloud.google.com/spanner/docs/reads\">reading
from Cloud Spanner</a>.\n"
+ + "\n"
+ + "Example configuration for performing a read using a SQL query: ::\n"
+ + "\n"
+ + " pipeline:\n"
+ + " transforms:\n"
+ + " - type: ReadFromSpanner\n"
+ + " config:\n"
+ + " instance_id: 'my-instance-id'\n"
+ + " database_id: 'my-database'\n"
+ + " query: 'SELECT * FROM table'\n"
+ + "\n"
Review Comment:
FYI we should try to keep this documentation relatively
language-independent, as it will be generated for multiple remote SDKs (not
just YAML).
https://github.com/apache/beam/blob/2488ca131bed3f28c92fa7b38b7506a461818a3a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/SchemaTransformProvider.java#L42-L45
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]