@@ -133,6 +133,27 @@ type ExternalDataConfig struct {
133133 // Metadata Cache Mode for the table. Set this to
134134 // enable caching of metadata from external data source.
135135 MetadataCacheMode MetadataCacheMode
136+
137+ // Time zone used when parsing timestamp values that do not
138+ // have specific time zone information (e.g. 2024-04-20 12:34:56).
139+ // The expected format is a IANA timezone string (e.g. America/Los_Angeles).
140+ TimeZone string
141+
142+ // Format used to parse DATE values. Supports C-style and
143+ // SQL-style values
144+ DateFormat string
145+
146+ // Format used to parse DATETIME values. Supports
147+ // C-style and SQL-style values.
148+ DatetimeFormat string
149+
150+ // Format used to parse TIME values. Supports C-style and
151+ // SQL-style values.
152+ TimeFormat string
153+
154+ // Format used to parse TIMESTAMP values. Supports
155+ // C-style and SQL-style values.
156+ TimestampFormat string
136157}
137158
138159func (e * ExternalDataConfig ) toBQ () bq.ExternalDataConfiguration {
@@ -147,6 +168,11 @@ func (e *ExternalDataConfig) toBQ() bq.ExternalDataConfiguration {
147168 ConnectionId : e .ConnectionID ,
148169 ReferenceFileSchemaUri : e .ReferenceFileSchemaURI ,
149170 MetadataCacheMode : string (e .MetadataCacheMode ),
171+ TimeZone : e .TimeZone ,
172+ DateFormat : e .DateFormat ,
173+ DatetimeFormat : e .DatetimeFormat ,
174+ TimeFormat : e .TimeFormat ,
175+ TimestampFormat : e .TimestampFormat ,
150176 }
151177 if e .Schema != nil {
152178 q .Schema = e .Schema .toBQ ()
@@ -173,6 +199,11 @@ func bqToExternalDataConfig(q *bq.ExternalDataConfiguration) (*ExternalDataConfi
173199 ConnectionID : q .ConnectionId ,
174200 ReferenceFileSchemaURI : q .ReferenceFileSchemaUri ,
175201 MetadataCacheMode : MetadataCacheMode (q .MetadataCacheMode ),
202+ TimeZone : q .TimeZone ,
203+ TimestampFormat : q .TimestampFormat ,
204+ TimeFormat : q .TimeFormat ,
205+ DateFormat : q .DateFormat ,
206+ DatetimeFormat : q .DatetimeFormat ,
176207 }
177208 for _ , v := range q .DecimalTargetTypes {
178209 e .DecimalTargetTypes = append (e .DecimalTargetTypes , DecimalTargetType (v ))
@@ -257,11 +288,26 @@ type CSVOptions struct {
257288
258289 // An optional custom string that will represent a NULL
259290 // value in CSV import data.
291+ //
292+ // NullMarker and NullMarkers are mutually exclusive and should not be set at the same time.
260293 NullMarker string
261294
295+ // An optional list of custom strings that will represent
296+ // a NULL value in CSV import data.
297+ //
298+ // NullMarker and NullMarkers are mutually exclusive and should not be set at the same time.
299+ NullMarkers []string
300+
262301 // Preserves the embedded ASCII control characters (the first 32 characters in the ASCII-table,
263302 // from '\\x00' to '\\x1F') when loading from CSV. Only applicable to CSV, ignored for other formats.
264303 PreserveASCIIControlCharacters bool
304+
305+ // SourceColumnMatch controls the strategy used to match loaded columns to the schema.
306+ // If not set, a sensible default is chosen based on how the schema is provided. If
307+ // autodetect is used, then columns are matched by name. Otherwise, columns
308+ // are matched by position. This is done to keep the behavior
309+ // backward-compatible.
310+ SourceColumnMatch SourceColumnMatch
265311}
266312
267313func (o * CSVOptions ) populateExternalDataConfig (c * bq.ExternalDataConfiguration ) {
@@ -273,6 +319,8 @@ func (o *CSVOptions) populateExternalDataConfig(c *bq.ExternalDataConfiguration)
273319 Quote : o .quote (),
274320 SkipLeadingRows : o .SkipLeadingRows ,
275321 NullMarker : o .NullMarker ,
322+ NullMarkers : o .NullMarkers ,
323+ SourceColumnMatch : string (o .SourceColumnMatch ),
276324 PreserveAsciiControlCharacters : o .PreserveASCIIControlCharacters ,
277325 }
278326}
@@ -306,6 +354,8 @@ func bqToCSVOptions(q *bq.CsvOptions) *CSVOptions {
306354 FieldDelimiter : q .FieldDelimiter ,
307355 SkipLeadingRows : q .SkipLeadingRows ,
308356 NullMarker : q .NullMarker ,
357+ NullMarkers : q .NullMarkers ,
358+ SourceColumnMatch : SourceColumnMatch (q .SourceColumnMatch ),
309359 PreserveASCIIControlCharacters : q .PreserveAsciiControlCharacters ,
310360 }
311361 o .setQuote (q .Quote )
0 commit comments