google-cloud-bigquery 1.56.0 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3485b40defd1415a416e32191f08ab9fbb204679b74a7aa3798497b6106279af
4
- data.tar.gz: 0f4edb30dcd40818937a90cc4e746ab79964201cdd02d3145a997e273d062523
3
+ metadata.gz: dbe17241cff1bf35169627f5be2bc589b24e4830077b1966192d74cb478efcc0
4
+ data.tar.gz: a6060857441bd335b1a8c67509f742d586026e043269d48893c22e4ffe3a3b9f
5
5
  SHA512:
6
- metadata.gz: 7caacb39dd2694de5dd70470274db28893f9841c17321c72b6b1ed82c2abc1c1f8b9ed65bf65271b2fc62939234b82fdc24150108ad6617093f938af278532b7
7
- data.tar.gz: 97807b56c6ff51d7f039c30f2c096617e8ce76e12f4d9017e4e63bde6e705a1200b052c7b403a7c70c15e0565f8657f19186d2055bac4f59f4df8db7b4b73449
6
+ metadata.gz: 361370e039788d37aaebe2c3dc368e3715e7f09c65ffc85727285c1cdfe608412e09352570e3f1c88abb52b52c851646540c67e3c023c344ef1d8f37cab78086
7
+ data.tar.gz: 8b86e329d6843a4d4387f1c1daf1ed3feaabe47284ad4e8320ce3c9e39a492fadbecfe46006e1b0a38fedbe94250795aa0968a2148c94e0f1bf25a4514ad2d92
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 1.57.0 (2025-08-28)
4
+
5
+ #### Features
6
+
7
+ * Add support for reference_file_schema_uri for LoadJobConfig and ExternalDataSource ([#30859](https://github.com/googleapis/google-cloud-ruby/issues/30859))
8
+
3
9
  ### 1.56.0 (2025-08-27)
4
10
 
5
11
  #### Features
@@ -504,6 +504,49 @@ module Google
504
504
  @gapi.max_bad_records = new_max_bad_records
505
505
  end
506
506
 
507
+ ##
508
+ # The URI of a reference file with the table schema. This is enabled
509
+ # for the following formats: `AVRO`, `PARQUET`, `ORC`.
510
+ #
511
+ # @return [String, nil] The URI. `nil` if not set.
512
+ #
513
+ # @example
514
+ # require "google/cloud/bigquery"
515
+ #
516
+ # bigquery = Google::Cloud::Bigquery.new
517
+ #
518
+ # external_data = bigquery.external "gs://bucket/path/to/data.avro", format: :avro do |ext|
519
+ # ext.reference_file_schema_uri = "gs://bucket/path/to/schema.json"
520
+ # end
521
+ #
522
+ # external_data.reference_file_schema_uri #=> "gs://bucket/path/to/schema.json"
523
+ #
524
+ def reference_file_schema_uri
525
+ @gapi.reference_file_schema_uri
526
+ end
527
+
528
+ ##
529
+ # Sets the URI of a reference file with the table schema. This is
530
+ # enabled for the following formats: `AVRO`, `PARQUET`, `ORC`.
531
+ #
532
+ # @param [String, nil] uri The URI. `nil` to unset.
533
+ #
534
+ # @example
535
+ # require "google/cloud/bigquery"
536
+ #
537
+ # bigquery = Google::Cloud::Bigquery.new
538
+ #
539
+ # external_data = bigquery.external "gs://bucket/path/to/data.avro", format: :avro do |ext|
540
+ # ext.reference_file_schema_uri = "gs://bucket/path/to/schema.json"
541
+ # end
542
+ #
543
+ # external_data.reference_file_schema_uri #=> "gs://bucket/path/to/schema.json"
544
+ #
545
+ def reference_file_schema_uri= uri
546
+ frozen_check!
547
+ @gapi.reference_file_schema_uri = uri
548
+ end
549
+
507
550
  ###
508
551
  # Checks if hive partitioning options are set.
509
552
  #
@@ -790,7 +833,8 @@ module Google
790
833
  end
791
834
 
792
835
  ##
793
- # Format used to parse TIME values. Supports C-style and SQL-style values.
836
+ # Format used to parse TIME values. Supports SQL-style values. See
837
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
794
838
  #
795
839
  # @return [String, nil] The time format pattern. `nil` if not set.
796
840
  #
@@ -800,17 +844,18 @@ module Google
800
844
  # bigquery = Google::Cloud::Bigquery.new
801
845
  #
802
846
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
803
- # ext.time_format = "%H:%M:%S"
847
+ # ext.time_format = "HH24:MI:SS"
804
848
  # end
805
849
  #
806
- # external_data.time_format #=> "%H:%M:%S"
850
+ # external_data.time_format #=> "HH24:MI:SS"
807
851
  #
808
852
  def time_format
809
853
  @gapi.time_format
810
854
  end
811
855
 
812
856
  ##
813
- # Sets the format used to parse TIME values. Supports C-style and SQL-style
857
+ # Sets the format used to parse TIME values. Supports SQL-style See
858
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
814
859
  # values.
815
860
  #
816
861
  # @param [String, nil] time_format The time format pattern. `nil` if not set.
@@ -821,10 +866,10 @@ module Google
821
866
  # bigquery = Google::Cloud::Bigquery.new
822
867
  #
823
868
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
824
- # ext.time_format = "%H:%M:%S"
869
+ # ext.time_format = "HH24:MI:SS"
825
870
  # end
826
871
  #
827
- # external_data.time_format #=> "%H:%M:%S"
872
+ # external_data.time_format #=> "HH24:MI:SS"
828
873
  #
829
874
  def time_format= time_format
830
875
  frozen_check!
@@ -832,8 +877,8 @@ module Google
832
877
  end
833
878
 
834
879
  ##
835
- # Format used to parse TIMESTAMP values. Supports C-style and SQL-style
836
- # values.
880
+ # Format used to parse TIMESTAMP values. Supports SQL-style values. See
881
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
837
882
  #
838
883
  # @return [String, nil] The timestamp format pattern. `nil` if not set.
839
884
  #
@@ -843,18 +888,19 @@ module Google
843
888
  # bigquery = Google::Cloud::Bigquery.new
844
889
  #
845
890
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
846
- # ext.timestamp_format = "%Y-%m-%d %H:%M:%S.%f %z"
891
+ # ext.timestamp_format = "YYYY-MM-DD HH24:MI:SS.FF3 TZH"
847
892
  # end
848
893
  #
849
- # external_data.timestamp_format #=> "%Y-%m-%d %H:%M:%S.%f %z"
894
+ # external_data.timestamp_format #=> "YYYY-MM-DD HH24:MI:SS.FF3 TZH"
850
895
  #
851
896
  def timestamp_format
852
897
  @gapi.timestamp_format
853
898
  end
854
899
 
855
900
  ##
856
- # Sets the format used to parse TIMESTAMP values. Supports C-style and SQL-style
857
- # values.
901
+ # Sets the format used to parse TIMESTAMP values. Supports SQL-style
902
+ # values. See
903
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
858
904
  #
859
905
  # @param [String, nil] timestamp_format The timestamp format pattern. `nil` to unset.
860
906
  #
@@ -864,10 +910,10 @@ module Google
864
910
  # bigquery = Google::Cloud::Bigquery.new
865
911
  #
866
912
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
867
- # ext.timestamp_format = "%Y-%m-%d %H:%M:%S.%f %z"
913
+ # ext.timestamp_format = "YYYY-MM-DD HH24:MI:SS.FF3 TZH"
868
914
  # end
869
915
  #
870
- # external_data.timestamp_format #=> "%Y-%m-%d %H:%M:%S.%f %z"
916
+ # external_data.timestamp_format #=> "YYYY-MM-DD HH24:MI:SS.FF3 TZH"
871
917
  #
872
918
  def timestamp_format= timestamp_format
873
919
  frozen_check!
@@ -875,8 +921,8 @@ module Google
875
921
  end
876
922
 
877
923
  ##
878
- # Format used to parse DATETIME values. Supports C-style and SQL-style
879
- # values.
924
+ # Format used to parse DATETIME values. Supports SQL-style values. See
925
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
880
926
  #
881
927
  # @return [String, nil] The datetime format pattern. `nil` if not set.
882
928
  #
@@ -886,18 +932,19 @@ module Google
886
932
  # bigquery = Google::Cloud::Bigquery.new
887
933
  #
888
934
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
889
- # ext.datetime_format = "%Y-%m-%d %H:%M:%S"
935
+ # ext.datetime_format = "YYYY-MM-DD HH24:MI:SS"
890
936
  # end
891
937
  #
892
- # external_data.datetime_format #=> "%Y-%m-%d %H:%M:%S"
938
+ # external_data.datetime_format #=> "YYYY-MM-DD HH24:MI:SS"
893
939
  #
894
940
  def datetime_format
895
941
  @gapi.datetime_format
896
942
  end
897
943
 
898
944
  ##
899
- # Sets the format used to parse DATETIME values. Supports C-style and SQL-style
900
- # values.
945
+ # Sets the format used to parse DATETIME values. Supports SQL-style
946
+ # values. See
947
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
901
948
  #
902
949
  # @param [String, nil] datetime_format The datetime format pattern. `nil` to unset.
903
950
  #
@@ -907,10 +954,10 @@ module Google
907
954
  # bigquery = Google::Cloud::Bigquery.new
908
955
  #
909
956
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
910
- # ext.datetime_format = "%Y-%m-%d %H:%M:%S"
957
+ # ext.datetime_format = "YYYY-MM-DD HH24:MI:SS"
911
958
  # end
912
959
  #
913
- # external_data.datetime_format #=> "%Y-%m-%d %H:%M:%S"
960
+ # external_data.datetime_format #=> "YYYY-MM-DD HH24:MI:SS"
914
961
  #
915
962
  def datetime_format= datetime_format
916
963
  frozen_check!
@@ -918,8 +965,8 @@ module Google
918
965
  end
919
966
 
920
967
  ##
921
- # Format used to parse DATE values. Supports C-style and SQL-style
922
- # values.
968
+ # Format used to parse DATE values. Supports SQL-style values. See
969
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
923
970
  #
924
971
  # @return [String, nil] The date format pattern. `nil` if not set.
925
972
  #
@@ -929,18 +976,19 @@ module Google
929
976
  # bigquery = Google::Cloud::Bigquery.new
930
977
  #
931
978
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
932
- # ext.date_format = "%Y-%m-%d"
979
+ # ext.date_format = "YYYY-MM-DD"
933
980
  # end
934
981
  #
935
- # external_data.date_format #=> "%Y-%m-%d"
982
+ # external_data.date_format #=> "YYYY-MM-DD"
936
983
  #
937
984
  def date_format
938
985
  @gapi.date_format
939
986
  end
940
987
 
941
988
  ##
942
- # Sets the format used to parse DATE values. Supports C-style and SQL-style
943
- # values.
989
+ # Sets the format used to parse DATE values. Supports SQL-style
990
+ # values. See
991
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
944
992
  #
945
993
  # @param [String, nil] date_format The date format pattern. `nil` to unset.
946
994
  #
@@ -950,10 +998,10 @@ module Google
950
998
  # bigquery = Google::Cloud::Bigquery.new
951
999
  #
952
1000
  # external_data = bigquery.external "gs://bucket/path/to/data.csv" do |ext|
953
- # ext.date_format = "%Y-%m-%d"
1001
+ # ext.date_format = "YYYY-MM-DD"
954
1002
  # end
955
1003
  #
956
- # external_data.date_format #=> "%Y-%m-%d"
1004
+ # external_data.date_format #=> "YYYY-MM-DD"
957
1005
  #
958
1006
  def date_format= date_format
959
1007
  frozen_check!
@@ -653,41 +653,41 @@ module Google
653
653
  end
654
654
 
655
655
  ##
656
- # Format used to parse DATE values. Supports C-style and SQL-style
657
- # values.
656
+ # Format used to parse DATE values. Supports SQL-style values. See
657
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
658
658
  #
659
659
  # @return [String, nil] The date format pattern, such as
660
- # `%Y-%m-%d`. `nil` if not set.
660
+ # `YYYY-MM-DD`. `nil` if not set.
661
661
  def date_format
662
662
  @gapi.configuration.load.date_format
663
663
  end
664
664
 
665
665
  ##
666
- # Format used to parse DATETIME values. Supports C-style and SQL-style
667
- # values.
666
+ # Format used to parse DATETIME values. Supports SQL-style values. See
667
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
668
668
  #
669
669
  # @return [String, nil] The datetime format pattern, such as
670
- # `%Y-%m-%d %H:%M:%S`. `nil` if not set.
670
+ # `YYYY-MM-DD HH24:MI:SS`. `nil` if not set.
671
671
  def datetime_format
672
672
  @gapi.configuration.load.datetime_format
673
673
  end
674
674
 
675
675
  ##
676
- # Format used to parse TIME values. Supports C-style and SQL-style
677
- # values.
676
+ # Format used to parse TIME values. Supports SQL-style values. See
677
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
678
678
  #
679
679
  # @return [String, nil] The time format pattern, such as
680
- # `%H:%M:%S`. `nil` if not set.
680
+ # `HH24:MI:SS`. `nil` if not set.
681
681
  def time_format
682
682
  @gapi.configuration.load.time_format
683
683
  end
684
684
 
685
685
  ##
686
- # Format used to parse TIMESTAMP values. Supports C-style and SQL-style
687
- # values.
686
+ # Format used to parse TIMESTAMP values. Supports SQL-style values. See
687
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
688
688
  #
689
689
  # @return [String, nil] The timestamp format pattern, such as
690
- # `%Y-%m-%d %H:%M:%S.%f %z`. `nil` if not set.
690
+ # `YYYY-MM-DD HH24:MI:SS.FF3 TZH`. `nil` if not set.
691
691
  def timestamp_format
692
692
  @gapi.configuration.load.timestamp_format
693
693
  end
@@ -737,6 +737,15 @@ module Google
737
737
  end
738
738
 
739
739
  ##
740
+ # The URI of thereference file with the reader schema. This file is only
741
+ # loaded if it is part of source URIs, but is not loaded otherwise.
742
+ # It is enabled for the following formats: `AVRO`, `PARQUET`, `ORC`.
743
+ #
744
+ # @return [String, nil] The URI of the reference file, or `nil` if not set.
745
+ def reference_file_schema_uri
746
+ @gapi.configuration.load.reference_file_schema_uri
747
+ end
748
+
740
749
  # When source_format is set to `CSV`, indicates if the embedded ASCII
741
750
  # control characters (the first 32 characters in the ASCII-table, from
742
751
  # `\x00` to `\x1F`) are preserved. By default, ASCII control
@@ -2682,41 +2691,45 @@ module Google
2682
2691
  end
2683
2692
 
2684
2693
  ##
2685
- # Sets the format used to parse DATE values. Supports C-style and SQL-style
2686
- # values.
2694
+ # Sets the format used to parse DATE values. Supports SQL-style
2695
+ # values. See
2696
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2687
2697
  #
2688
2698
  # @param [String, nil] date_format The date format pattern, such as
2689
- # `%Y-%m-%d`. `nil` to unset.
2699
+ # `YYYY-MM-DD`. `nil` to unset.
2690
2700
  def date_format= date_format
2691
2701
  @gapi.configuration.load.update! date_format: date_format
2692
2702
  end
2693
2703
 
2694
2704
  ##
2695
- # Sets the format used to parse DATETIME values. Supports C-style and SQL-style
2696
- # values.
2705
+ # Sets the format used to parse DATETIME values. Supports SQL-style
2706
+ # values. See
2707
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2697
2708
  #
2698
2709
  # @param [String, nil] datetime_format The datetime format pattern, such as
2699
- # `%Y-%m-%d %H:%M:%S`. `nil` to unset.
2710
+ # `YYYY-MM-DD HH24:MI:SS`. `nil` to unset.
2700
2711
  def datetime_format= datetime_format
2701
2712
  @gapi.configuration.load.update! datetime_format: datetime_format
2702
2713
  end
2703
2714
 
2704
2715
  ##
2705
- # Sets the format used to parse TIME values. Supports C-style and SQL-style
2706
- # values.
2716
+ # Sets the format used to parse TIME values. Supports SQL-style
2717
+ # values. See
2718
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2707
2719
  #
2708
2720
  # @param [String, nil] time_format The time format pattern, such as
2709
- # `%H:%M:%S`. `nil` to unset.
2721
+ # `HH24:MI:SS`. `nil` to unset.
2710
2722
  def time_format= time_format
2711
2723
  @gapi.configuration.load.update! time_format: time_format
2712
2724
  end
2713
2725
 
2714
2726
  ##
2715
- # Sets the format used to parse TIMESTAMP values. Supports C-style and SQL-style
2716
- # values.
2727
+ # Sets the format used to parse TIMESTAMP values. Supports SQL-style
2728
+ # values. See
2729
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2717
2730
  #
2718
2731
  # @param [String, nil] timestamp_format The timestamp format pattern, such as
2719
- # `%Y-%m-%d %H:%M:%S.%f %z`. `nil` to unset.
2732
+ # `YYYY-MM-DD HH24:MI:SS.FF3 TZH`. `nil` to unset.
2720
2733
  def timestamp_format= timestamp_format
2721
2734
  @gapi.configuration.load.update! timestamp_format: timestamp_format
2722
2735
  end
@@ -2765,6 +2778,17 @@ module Google
2765
2778
  end
2766
2779
 
2767
2780
  ##
2781
+
2782
+ # Sets the URI of thereference file with the reader schema. This file
2783
+ # is only loaded if it is part of source URIs, but is not loaded
2784
+ # otherwise. It is enabled for the following formats: `AVRO`,
2785
+ # `PARQUET`, `ORC`.
2786
+ #
2787
+ # @param [String, nil] uri The URI of the reference file, or `nil` to unset.
2788
+ def reference_file_schema_uri= uri
2789
+ @gapi.configuration.load.update! reference_file_schema_uri: uri
2790
+ end
2791
+
2768
2792
  # When source_format is set to `CSV`, sets whether the embedded ASCII
2769
2793
  # control characters (the first 32 characters in the ASCII-table, from
2770
2794
  # `\x00` to `\x1F`) are preserved. By default, ASCII control
@@ -1116,6 +1116,42 @@ module Google
1116
1116
  # else the property will be ignored by the backend.
1117
1117
  # @param [string] session_id Session ID in which the load job must run.
1118
1118
  # @param [string] project_id Project ID where the destination table exists.
1119
+ # @param [Boolean] dryrun If set, don't actually run this job. Behavior
1120
+ # is undefined however for non-query jobs and may result in an error.
1121
+ # Deprecated.
1122
+ # @param [String] date_format Format used to parse DATE values.
1123
+ # Supports SQL-style format strings. See
1124
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1125
+ # @param [String] datetime_format Format used to parse DATETIME
1126
+ # values. Supports SQL-style format strings. See
1127
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1128
+ # @param [String] time_format Format used to parse TIME values.
1129
+ # Supports SQL-style format strings. See
1130
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1131
+ # @param [String] timestamp_format Format used to parse
1132
+ # TIMESTAMP values. Supports SQL-style format strings. See
1133
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1134
+ # @param [Array<String>] null_markers A list of strings represented as
1135
+ # SQL NULL value in a CSV file. null_marker and null_markers can't be
1136
+ # set at the same time. If null_marker is set, null_markers has to be
1137
+ # not set. If null_markers is set, null_marker has to be not set. If
1138
+ # both null_marker and null_markers are set at the same time, a user
1139
+ # error would be thrown. Any strings listed in null_markers, including
1140
+ # empty string would be interpreted as SQL NULL. This applies to all
1141
+ # column types.
1142
+ # @param [String] source_column_match Controls the strategy used to
1143
+ # match loaded columns to the schema. If not set, a sensible default is
1144
+ # chosen based on how the schema is provided. If autodetect is used,
1145
+ # then columns are matched by name. Otherwise, columns are matched by
1146
+ # position. This is done to keep the behavior backward-compatible.
1147
+ #
1148
+ # Acceptable values are:
1149
+ # * `POSITION` - matches by position. This assumes that the columns are
1150
+ # ordered the same way as the schema.
1151
+ # * `NAME` - matches by name. This reads the header row as column names
1152
+ # and reorders columns to match the field names in the schema.
1153
+ # @param [String] time_zone The time zone used when parsing timestamp
1154
+ # values.
1119
1155
  #
1120
1156
  # @yield [updater] A block for setting the schema and other
1121
1157
  # options for the destination table. The schema can be omitted if the
@@ -1123,9 +1159,6 @@ module Google
1123
1159
  # Google Cloud Datastore backup.
1124
1160
  # @yieldparam [Google::Cloud::Bigquery::LoadJob::Updater] updater An
1125
1161
  # updater to modify the load job and its schema.
1126
- # @param [Boolean] dryrun If set, don't actually run this job. Behavior
1127
- # is undefined however for non-query jobs and may result in an error.
1128
- # Deprecated.
1129
1162
  #
1130
1163
  # @return [Google::Cloud::Bigquery::LoadJob] A new load job object.
1131
1164
  #
@@ -1143,7 +1176,9 @@ module Google
1143
1176
  projection_fields: nil, jagged_rows: nil, quoted_newlines: nil, encoding: nil,
1144
1177
  delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
1145
1178
  skip_leading: nil, schema: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
1146
- null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, project_id: nil, &block
1179
+ null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, project_id: nil,
1180
+ date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
1181
+ null_markers: nil, source_column_match: nil, time_zone: nil, &block
1147
1182
  ensure_service!
1148
1183
  dataset_id ||= "_SESSION" unless create_session.nil? && session_id.nil?
1149
1184
  session_dataset = dataset dataset_id, skip_lookup: true, project_id: project_id
@@ -1155,7 +1190,10 @@ module Google
1155
1190
  max_bad_records: max_bad_records, quote: quote, skip_leading: skip_leading,
1156
1191
  dryrun: dryrun, schema: schema, job_id: job_id, prefix: prefix, labels: labels,
1157
1192
  autodetect: autodetect, null_marker: null_marker, create_session: create_session,
1158
- session_id: session_id, &block
1193
+ session_id: session_id, date_format: date_format, datetime_format: datetime_format,
1194
+ time_format: time_format, timestamp_format: timestamp_format,
1195
+ null_markers: null_markers, source_column_match: source_column_match,
1196
+ time_zone: time_zone, &block
1159
1197
  end
1160
1198
 
1161
1199
  ##
@@ -1277,6 +1315,39 @@ module Google
1277
1315
  # this option. Also note that for most use cases, the block yielded by
1278
1316
  # this method is a more convenient way to configure the schema.
1279
1317
  # @param [string] session_id Session ID in which the load job must run.
1318
+ # @param [String] date_format Format used to parse DATE values.
1319
+ # Supports SQL-style format strings. See
1320
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1321
+ # @param [String] datetime_format Format used to parse DATETIME
1322
+ # values. Supports SQL-style format strings. See
1323
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1324
+ # @param [String] time_format Format used to parse TIME values.
1325
+ # Supports SQL-style format strings. See
1326
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1327
+ # @param [String] timestamp_format Format used to parse
1328
+ # TIMESTAMP values. Supports SQL-style format strings. See
1329
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
1330
+ # @param [Array<String>] null_markers A list of strings represented as
1331
+ # SQL NULL value in a CSV file. null_marker and null_markers can't be
1332
+ # set at the same time. If null_marker is set, null_markers has to be
1333
+ # not set. If null_markers is set, null_marker has to be not set. If
1334
+ # both null_marker and null_markers are set at the same time, a user
1335
+ # error would be thrown. Any strings listed in null_markers, including
1336
+ # empty string would be interpreted as SQL NULL. This applies to all
1337
+ # column types.
1338
+ # @param [String] source_column_match Controls the strategy used to
1339
+ # match loaded columns to the schema. If not set, a sensible default is
1340
+ # chosen based on how the schema is provided. If autodetect is used,
1341
+ # then columns are matched by name. Otherwise, columns are matched by
1342
+ # position. This is done to keep the behavior backward-compatible.
1343
+ #
1344
+ # Acceptable values are:
1345
+ # * `POSITION` - matches by position. This assumes that the columns are
1346
+ # ordered the same way as the schema.
1347
+ # * `NAME` - matches by name. This reads the header row as column names
1348
+ # and reorders columns to match the field names in the schema.
1349
+ # @param [String] time_zone The time zone used when parsing timestamp
1350
+ # values.
1280
1351
  #
1281
1352
  # @yield [updater] A block for setting the schema of the destination
1282
1353
  # table and other options for the load job. The schema can be omitted
@@ -1306,13 +1377,18 @@ module Google
1306
1377
  def load table_id, files, dataset_id: "_SESSION", format: nil, create: nil, write: nil,
1307
1378
  projection_fields: nil, jagged_rows: nil, quoted_newlines: nil, encoding: nil,
1308
1379
  delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
1309
- skip_leading: nil, schema: nil, autodetect: nil, null_marker: nil, session_id: nil, &block
1380
+ skip_leading: nil, schema: nil, autodetect: nil, null_marker: nil, session_id: nil,
1381
+ date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
1382
+ null_markers: nil, source_column_match: nil, time_zone: nil, &block
1310
1383
  job = load_job table_id, files, dataset_id: dataset_id,
1311
1384
  format: format, create: create, write: write, projection_fields: projection_fields,
1312
1385
  jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
1313
1386
  delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
1314
1387
  quote: quote, skip_leading: skip_leading, schema: schema, autodetect: autodetect,
1315
- null_marker: null_marker, session_id: session_id, &block
1388
+ null_marker: null_marker, session_id: session_id, date_format: date_format,
1389
+ datetime_format: datetime_format, time_format: time_format,
1390
+ timestamp_format: timestamp_format, null_markers: null_markers,
1391
+ source_column_match: source_column_match, time_zone: time_zone, &block
1316
1392
 
1317
1393
  job.wait_until_done!
1318
1394
  ensure_job_succeeded! job
@@ -2451,6 +2451,39 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2451
2451
  # Note: This will work only for tables in _SESSION dataset
2452
2452
  # else the property will be ignored by the backend.
2453
2453
  # @param [string] session_id Session ID in which the load job must run.
2454
+ # @param [String] date_format Format used to parse DATE values.
2455
+ # Supports SQL-style format strings. See
2456
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2457
+ # @param [String] datetime_format Format used to parse DATETIME
2458
+ # values. Supports SQL-style format strings. See
2459
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2460
+ # @param [String] time_format Format used to parse TIME values.
2461
+ # Supports SQL-style format strings. See
2462
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2463
+ # @param [String] timestamp_format Format used to parse
2464
+ # TIMESTAMP values. Supports SQL-style format strings. See
2465
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2466
+ # @param [Array<String>] null_markers A list of strings represented as
2467
+ # SQL NULL value in a CSV file. null_marker and null_markers can't be
2468
+ # set at the same time. If null_marker is set, null_markers has to be
2469
+ # not set. If null_markers is set, null_marker has to be not set. If
2470
+ # both null_marker and null_markers are set at the same time, a user
2471
+ # error would be thrown. Any strings listed in null_markers, including
2472
+ # empty string would be interpreted as SQL NULL. This applies to all
2473
+ # column types.
2474
+ # @param [String] source_column_match Controls the strategy used to
2475
+ # match loaded columns to the schema. If not set, a sensible default is
2476
+ # chosen based on how the schema is provided. If autodetect is used,
2477
+ # then columns are matched by name. Otherwise, columns are matched by
2478
+ # position. This is done to keep the behavior backward-compatible.
2479
+ #
2480
+ # Acceptable values are:
2481
+ # * `POSITION` - matches by position. This assumes that the columns are
2482
+ # ordered the same way as the schema.
2483
+ # * `NAME` - matches by name. This reads the header row as column names
2484
+ # and reorders columns to match the field names in the schema.
2485
+ # @param [String] time_zone The time zone used when parsing timestamp
2486
+ # values.
2454
2487
  #
2455
2488
  # @yield [load_job] a block for setting the load job
2456
2489
  # @yieldparam [LoadJob] load_job the load job object to be updated
@@ -2507,7 +2540,9 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2507
2540
  def load_job files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
2508
2541
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2509
2542
  quote: nil, skip_leading: nil, job_id: nil, prefix: nil, labels: nil, autodetect: nil,
2510
- null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, schema: self.schema
2543
+ null_marker: nil, dryrun: nil, create_session: nil, session_id: nil, schema: self.schema,
2544
+ date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
2545
+ null_markers: nil, source_column_match: nil, time_zone: nil
2511
2546
  ensure_service!
2512
2547
 
2513
2548
  updater = load_job_updater format: format, create: create, write: write, projection_fields: projection_fields,
@@ -2516,8 +2551,10 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2516
2551
  max_bad_records: max_bad_records, quote: quote, skip_leading: skip_leading,
2517
2552
  dryrun: dryrun, job_id: job_id, prefix: prefix, schema: schema, labels: labels,
2518
2553
  autodetect: autodetect, null_marker: null_marker, create_session: create_session,
2519
- session_id: session_id
2520
-
2554
+ session_id: session_id, date_format: date_format,
2555
+ datetime_format: datetime_format, time_format: time_format,
2556
+ timestamp_format: timestamp_format, null_markers: null_markers,
2557
+ source_column_match: source_column_match, time_zone: time_zone
2521
2558
 
2522
2559
  yield updater if block_given?
2523
2560
 
@@ -2633,6 +2670,39 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2633
2670
  # value is `0`. This property is useful if you have header rows in the
2634
2671
  # file that should be skipped.
2635
2672
  # @param [string] session_id Session ID in which the load job must run.
2673
+ # @param [String] date_format Format used to parse DATE values.
2674
+ # Supports SQL-style format strings. See
2675
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2676
+ # @param [String] datetime_format Format used to parse DATETIME
2677
+ # values. Supports SQL-style format strings. See
2678
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2679
+ # @param [String] time_format Format used to parse TIME values.
2680
+ # Supports SQL-style format strings. See
2681
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2682
+ # @param [String] timestamp_format Format used to parse
2683
+ # TIMESTAMP values. Supports SQL-style format strings. See
2684
+ # [date and time formatting guide](https://cloud.google.com/bigquery/docs/reference/standard-sql/format-elements#format_date_time_as_string)
2685
+ # @param [Array<String>] null_markers A list of strings represented as
2686
+ # SQL NULL value in a CSV file. null_marker and null_markers can't be
2687
+ # set at the same time. If null_marker is set, null_markers has to be
2688
+ # not set. If null_markers is set, null_marker has to be not set. If
2689
+ # both null_marker and null_markers are set at the same time, a user
2690
+ # error would be thrown. Any strings listed in null_markers, including
2691
+ # empty string would be interpreted as SQL NULL. This applies to all
2692
+ # column types.
2693
+ # @param [String] source_column_match Controls the strategy used to
2694
+ # match loaded columns to the schema. If not set, a sensible default is
2695
+ # chosen based on how the schema is provided. If autodetect is used,
2696
+ # then columns are matched by name. Otherwise, columns are matched by
2697
+ # position. This is done to keep the behavior backward-compatible.
2698
+ #
2699
+ # Acceptable values are:
2700
+ # * `POSITION` - matches by position. This assumes that the columns are
2701
+ # ordered the same way as the schema.
2702
+ # * `NAME` - matches by name. This reads the header row as column names
2703
+ # and reorders columns to match the field names in the schema.
2704
+ # @param [String] time_zone The time zone used when parsing timestamp
2705
+ # values.
2636
2706
  #
2637
2707
  # @yield [updater] A block for setting the schema of the destination
2638
2708
  # table and other options for the load job. The schema can be omitted
@@ -2695,12 +2765,16 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
2695
2765
  def load files, format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
2696
2766
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil,
2697
2767
  quote: nil, skip_leading: nil, autodetect: nil, null_marker: nil, session_id: nil,
2698
- schema: self.schema, &block
2768
+ schema: self.schema, date_format: nil, datetime_format: nil, time_format: nil, timestamp_format: nil,
2769
+ null_markers: nil, source_column_match: nil, time_zone: nil, &block
2699
2770
  job = load_job files, format: format, create: create, write: write, projection_fields: projection_fields,
2700
2771
  jagged_rows: jagged_rows, quoted_newlines: quoted_newlines, encoding: encoding,
2701
2772
  delimiter: delimiter, ignore_unknown: ignore_unknown, max_bad_records: max_bad_records,
2702
2773
  quote: quote, skip_leading: skip_leading, autodetect: autodetect,
2703
- null_marker: null_marker, session_id: session_id, schema: schema, &block
2774
+ null_marker: null_marker, session_id: session_id, schema: schema,
2775
+ date_format: date_format, datetime_format: datetime_format, time_format: time_format,
2776
+ timestamp_format: timestamp_format, null_markers: null_markers,
2777
+ source_column_match: source_column_match, time_zone: time_zone, &block
2704
2778
 
2705
2779
  job.wait_until_done!
2706
2780
  ensure_job_succeeded! job
@@ -3167,36 +3241,49 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3167
3241
  end
3168
3242
 
3169
3243
  def load_job_csv_options! job, jagged_rows: nil, quoted_newlines: nil, delimiter: nil, quote: nil,
3170
- skip_leading: nil, null_marker: nil
3244
+ skip_leading: nil, null_marker: nil, null_markers: nil, source_column_match: nil
3171
3245
  job.jagged_rows = jagged_rows unless jagged_rows.nil?
3172
3246
  job.quoted_newlines = quoted_newlines unless quoted_newlines.nil?
3173
3247
  job.delimiter = delimiter unless delimiter.nil?
3174
3248
  job.null_marker = null_marker unless null_marker.nil?
3175
3249
  job.quote = quote unless quote.nil?
3176
3250
  job.skip_leading = skip_leading unless skip_leading.nil?
3251
+ job.null_markers = null_markers unless null_markers.nil?
3252
+ job.source_column_match = source_column_match unless source_column_match.nil?
3177
3253
  end
3178
3254
 
3179
3255
  def load_job_file_options! job, format: nil, projection_fields: nil, jagged_rows: nil, quoted_newlines: nil,
3180
3256
  encoding: nil, delimiter: nil, ignore_unknown: nil, max_bad_records: nil, quote: nil,
3181
- skip_leading: nil, null_marker: nil
3257
+ skip_leading: nil, null_marker: nil, date_format: nil, datetime_format: nil,
3258
+ time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
3259
+ time_zone: nil
3182
3260
  job.format = format unless format.nil?
3183
3261
  job.projection_fields = projection_fields unless projection_fields.nil?
3184
3262
  job.encoding = encoding unless encoding.nil?
3185
3263
  job.ignore_unknown = ignore_unknown unless ignore_unknown.nil?
3186
3264
  job.max_bad_records = max_bad_records unless max_bad_records.nil?
3265
+ job.date_format = date_format unless date_format.nil?
3266
+ job.datetime_format = datetime_format unless datetime_format.nil?
3267
+ job.time_format = time_format unless time_format.nil?
3268
+ job.timestamp_format = timestamp_format unless timestamp_format.nil?
3269
+ job.time_zone = time_zone unless time_zone.nil?
3187
3270
  load_job_csv_options! job, jagged_rows: jagged_rows,
3188
3271
  quoted_newlines: quoted_newlines,
3189
3272
  delimiter: delimiter,
3190
3273
  quote: quote,
3191
3274
  skip_leading: skip_leading,
3192
- null_marker: null_marker
3275
+ null_marker: null_marker,
3276
+ null_markers: null_markers,
3277
+ source_column_match: source_column_match
3193
3278
  end
3194
3279
 
3195
3280
  def load_job_updater format: nil, create: nil, write: nil, projection_fields: nil, jagged_rows: nil,
3196
3281
  quoted_newlines: nil, encoding: nil, delimiter: nil, ignore_unknown: nil,
3197
3282
  max_bad_records: nil, quote: nil, skip_leading: nil, dryrun: nil, schema: nil, job_id: nil,
3198
3283
  prefix: nil, labels: nil, autodetect: nil, null_marker: nil,
3199
- create_session: nil, session_id: nil
3284
+ create_session: nil, session_id: nil, date_format: nil, datetime_format: nil,
3285
+ time_format: nil, timestamp_format: nil, null_markers: nil, source_column_match: nil,
3286
+ time_zone: nil
3200
3287
  new_job = load_job_gapi table_id, dryrun, job_id: job_id, prefix: prefix
3201
3288
  LoadJob::Updater.new(new_job).tap do |job|
3202
3289
  job.location = location if location # may be table reference
@@ -3217,7 +3304,14 @@ format_options_use_int64_timestamp: format_options_use_int64_timestamp
3217
3304
  max_bad_records: max_bad_records,
3218
3305
  quote: quote,
3219
3306
  skip_leading: skip_leading,
3220
- null_marker: null_marker
3307
+ null_marker: null_marker,
3308
+ date_format: date_format,
3309
+ datetime_format: datetime_format,
3310
+ time_format: time_format,
3311
+ timestamp_format: timestamp_format,
3312
+ null_markers: null_markers,
3313
+ source_column_match: source_column_match,
3314
+ time_zone: time_zone
3221
3315
  end
3222
3316
  end
3223
3317
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.56.0".freeze
19
+ VERSION = "1.57.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.56.0
4
+ version: 1.57.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore