apache / apache/beam

[Feature Request]: Expose more query options to bigqueryio for go.

Open
#29,382 5 comments 2 reactions 2 assignees Claimed by @i05nagai View on GitHub
bigquery go new feature P2
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

### What would you like to happen?

Currently, the only option exposed to users when calling [Query()](https://pkg.go.dev/github.com/apache/beam/sdks/go/pkg/beam/io/bigqueryio#Query) is whether to use StandardSQL or LegacySQL syntax.

This leaves out some important options, the most urgent seems to be [QueryParameter](https://pkg.go.dev/cloud.google.com/go/bigquery#QueryParameter). This allows you to safely inject values into a query without opening yourself to a SQL injection attack.

Adding would be simple, a new value could be added to the [QueryOptions](https://pkg.go.dev/github.com/apache/beam/sdks/go/pkg/beam/io/bigqueryio#QueryOptions) struct. It could either be the slice [`[]bigquery.QueryParameter`](https://github.com/googleapis/google-cloud-go/blob/422c0b7565381a5441bc0e8fd81fe7401b961f2a/bigquery/query.go#L105) exposed in the underlying library's config options, or a custom struct that can be converted.

Once added to `QueryOptions`, it would need to be used within the Query itself which can be done [in the same manner of the existing LegacySQL option](https://github.com/apache/beam/blob/v2.32.0/sdks/go/pkg/beam/io/bigqueryio/bigquery.go#L151)

Another option that would be nice to be able to set is dataset id.

I'm willing to submit a PR if its something that sounds helpful.

### Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

### Issue Components

- [ ] Component: Python SDK
- [ ] Component: Java SDK
- [X] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.