@@ -105,6 +105,11 @@ type LoadConfig struct {
105
105
106
106
// MediaOptions stores options for customizing media upload.
107
107
MediaOptions []googleapi.MediaOption
108
+
109
+ // Controls the behavior of column naming during a load job.
110
+ // For more information, see:
111
+ // https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#columnnamecharactermap
112
+ ColumnNameCharacterMap ColumnNameCharacterMap
108
113
}
109
114
110
115
func (l * LoadConfig ) toBQ () (* bq.JobConfiguration , io.Reader ) {
@@ -124,6 +129,7 @@ func (l *LoadConfig) toBQ() (*bq.JobConfiguration, io.Reader) {
124
129
HivePartitioningOptions : l .HivePartitioningOptions .toBQ (),
125
130
ReferenceFileSchemaUri : l .ReferenceFileSchemaURI ,
126
131
CreateSession : l .CreateSession ,
132
+ ColumnNameCharacterMap : string (l .ColumnNameCharacterMap ),
127
133
},
128
134
JobTimeoutMs : l .JobTimeout .Milliseconds (),
129
135
}
@@ -153,6 +159,7 @@ func bqToLoadConfig(q *bq.JobConfiguration, c *Client) *LoadConfig {
153
159
HivePartitioningOptions : bqToHivePartitioningOptions (q .Load .HivePartitioningOptions ),
154
160
ReferenceFileSchemaURI : q .Load .ReferenceFileSchemaUri ,
155
161
CreateSession : q .Load .CreateSession ,
162
+ ColumnNameCharacterMap : ColumnNameCharacterMap (q .Load .ColumnNameCharacterMap ),
156
163
}
157
164
if q .JobTimeoutMs > 0 {
158
165
lc .JobTimeout = time .Duration (q .JobTimeoutMs ) * time .Millisecond
@@ -238,3 +245,24 @@ var (
238
245
// StringTargetType indicates the preferred type is STRING when supported.
239
246
StringTargetType DecimalTargetType = "STRING"
240
247
)
248
+
249
+ // ColumnNameCharacterMap is used to specific column naming behavior for load jobs.
250
+ type ColumnNameCharacterMap string
251
+
252
+ var (
253
+
254
+ // UnspecifiedColumnNameCharacterMap is the unspecified default value.
255
+ UnspecifiedColumnNameCharacterMap ColumnNameCharacterMap = "COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED"
256
+
257
+ // StrictColumnNameCharacterMap indicates support for flexible column names.
258
+ // Invalid column names will be rejected.
259
+ StrictColumnNameCharacterMap ColumnNameCharacterMap = "STRICT"
260
+
261
+ // V1ColumnNameCharacterMap indicates support for alphanumeric + underscore characters and names must start with a letter or underscore.
262
+ // Invalid column names will be normalized.
263
+ V1ColumnNameCharacterMap ColumnNameCharacterMap = "V1"
264
+
265
+ // V2ColumnNameCharacterMap indicates support for flexible column names.
266
+ // Invalid column names will be normalized.
267
+ V2ColumnNameCharacterMap ColumnNameCharacterMap = "V2"
268
+ )
0 commit comments