google-cloud-bigquery 1.54.0 → 1.58.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 +4 -4
- data/CHANGELOG.md +24 -0
- data/lib/google/cloud/bigquery/condition.rb +218 -0
- data/lib/google/cloud/bigquery/dataset/access.rb +281 -28
- data/lib/google/cloud/bigquery/dataset.rb +9 -3
- data/lib/google/cloud/bigquery/external/csv_source.rb +47 -0
- data/lib/google/cloud/bigquery/external/data_source.rb +78 -30
- data/lib/google/cloud/bigquery/load_job.rb +72 -24
- data/lib/google/cloud/bigquery/project.rb +117 -13
- data/lib/google/cloud/bigquery/remote_function_options.rb +156 -0
- data/lib/google/cloud/bigquery/routine.rb +76 -0
- data/lib/google/cloud/bigquery/service.rb +9 -8
- data/lib/google/cloud/bigquery/table.rb +104 -10
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +3 -1
|
@@ -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
|
|
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 = "
|
|
847
|
+
# ext.time_format = "HH24:MI:SS"
|
|
804
848
|
# end
|
|
805
849
|
#
|
|
806
|
-
# external_data.time_format #=> "
|
|
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
|
|
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 = "
|
|
869
|
+
# ext.time_format = "HH24:MI:SS"
|
|
825
870
|
# end
|
|
826
871
|
#
|
|
827
|
-
# external_data.time_format #=> "
|
|
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
|
|
836
|
-
#
|
|
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 = "
|
|
891
|
+
# ext.timestamp_format = "YYYY-MM-DD HH24:MI:SS.FF3 TZH"
|
|
847
892
|
# end
|
|
848
893
|
#
|
|
849
|
-
# external_data.timestamp_format #=> "
|
|
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
|
|
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 = "
|
|
913
|
+
# ext.timestamp_format = "YYYY-MM-DD HH24:MI:SS.FF3 TZH"
|
|
868
914
|
# end
|
|
869
915
|
#
|
|
870
|
-
# external_data.timestamp_format #=> "
|
|
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
|
|
879
|
-
#
|
|
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 = "
|
|
935
|
+
# ext.datetime_format = "YYYY-MM-DD HH24:MI:SS"
|
|
890
936
|
# end
|
|
891
937
|
#
|
|
892
|
-
# external_data.datetime_format #=> "
|
|
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
|
|
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 = "
|
|
957
|
+
# ext.datetime_format = "YYYY-MM-DD HH24:MI:SS"
|
|
911
958
|
# end
|
|
912
959
|
#
|
|
913
|
-
# external_data.datetime_format #=> "
|
|
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
|
|
922
|
-
#
|
|
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 = "
|
|
979
|
+
# ext.date_format = "YYYY-MM-DD"
|
|
933
980
|
# end
|
|
934
981
|
#
|
|
935
|
-
# external_data.date_format #=> "
|
|
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
|
|
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 = "
|
|
1001
|
+
# ext.date_format = "YYYY-MM-DD"
|
|
954
1002
|
# end
|
|
955
1003
|
#
|
|
956
|
-
# external_data.date_format #=> "
|
|
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
|
|
657
|
-
#
|
|
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
|
-
#
|
|
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
|
|
667
|
-
#
|
|
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
|
-
#
|
|
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
|
|
677
|
-
#
|
|
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
|
-
#
|
|
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
|
|
687
|
-
#
|
|
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
|
-
#
|
|
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
|
|
@@ -736,6 +736,27 @@ module Google
|
|
|
736
736
|
@gapi.configuration.load.time_zone
|
|
737
737
|
end
|
|
738
738
|
|
|
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
|
+
|
|
749
|
+
# When source_format is set to `CSV`, indicates if the embedded ASCII
|
|
750
|
+
# control characters (the first 32 characters in the ASCII-table, from
|
|
751
|
+
# `\x00` to `\x1F`) are preserved. By default, ASCII control
|
|
752
|
+
# characters are not preserved.
|
|
753
|
+
#
|
|
754
|
+
# @return [Boolean, nil] whether or not ASCII control characters are
|
|
755
|
+
# preserved. `nil` if not set.
|
|
756
|
+
def preserve_ascii_control_characters
|
|
757
|
+
@gapi.configuration.load.preserve_ascii_control_characters
|
|
758
|
+
end
|
|
759
|
+
|
|
739
760
|
##
|
|
740
761
|
# Yielded to a block to accumulate changes for a patch request.
|
|
741
762
|
class Updater < LoadJob
|
|
@@ -2670,41 +2691,45 @@ module Google
|
|
|
2670
2691
|
end
|
|
2671
2692
|
|
|
2672
2693
|
##
|
|
2673
|
-
# Sets the format used to parse DATE values. Supports
|
|
2674
|
-
# 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)
|
|
2675
2697
|
#
|
|
2676
2698
|
# @param [String, nil] date_format The date format pattern, such as
|
|
2677
|
-
#
|
|
2699
|
+
# `YYYY-MM-DD`. `nil` to unset.
|
|
2678
2700
|
def date_format= date_format
|
|
2679
2701
|
@gapi.configuration.load.update! date_format: date_format
|
|
2680
2702
|
end
|
|
2681
2703
|
|
|
2682
2704
|
##
|
|
2683
|
-
# Sets the format used to parse DATETIME values. Supports
|
|
2684
|
-
# 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)
|
|
2685
2708
|
#
|
|
2686
2709
|
# @param [String, nil] datetime_format The datetime format pattern, such as
|
|
2687
|
-
#
|
|
2710
|
+
# `YYYY-MM-DD HH24:MI:SS`. `nil` to unset.
|
|
2688
2711
|
def datetime_format= datetime_format
|
|
2689
2712
|
@gapi.configuration.load.update! datetime_format: datetime_format
|
|
2690
2713
|
end
|
|
2691
2714
|
|
|
2692
2715
|
##
|
|
2693
|
-
# Sets the format used to parse TIME values. Supports
|
|
2694
|
-
# 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)
|
|
2695
2719
|
#
|
|
2696
2720
|
# @param [String, nil] time_format The time format pattern, such as
|
|
2697
|
-
#
|
|
2721
|
+
# `HH24:MI:SS`. `nil` to unset.
|
|
2698
2722
|
def time_format= time_format
|
|
2699
2723
|
@gapi.configuration.load.update! time_format: time_format
|
|
2700
2724
|
end
|
|
2701
2725
|
|
|
2702
2726
|
##
|
|
2703
|
-
# Sets the format used to parse TIMESTAMP values. Supports
|
|
2704
|
-
# 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)
|
|
2705
2730
|
#
|
|
2706
2731
|
# @param [String, nil] timestamp_format The timestamp format pattern, such as
|
|
2707
|
-
#
|
|
2732
|
+
# `YYYY-MM-DD HH24:MI:SS.FF3 TZH`. `nil` to unset.
|
|
2708
2733
|
def timestamp_format= timestamp_format
|
|
2709
2734
|
@gapi.configuration.load.update! timestamp_format: timestamp_format
|
|
2710
2735
|
end
|
|
@@ -2752,6 +2777,29 @@ module Google
|
|
|
2752
2777
|
@gapi.configuration.load.update! time_zone: time_zone
|
|
2753
2778
|
end
|
|
2754
2779
|
|
|
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
|
+
|
|
2792
|
+
# When source_format is set to `CSV`, sets whether the embedded ASCII
|
|
2793
|
+
# control characters (the first 32 characters in the ASCII-table, from
|
|
2794
|
+
# `\x00` to `\x1F`) are preserved. By default, ASCII control
|
|
2795
|
+
# characters are not preserved.
|
|
2796
|
+
#
|
|
2797
|
+
# @param [Boolean, nil] val whether or not ASCII control characters
|
|
2798
|
+
# are preserved. `nil` to unset.
|
|
2799
|
+
def preserve_ascii_control_characters= val
|
|
2800
|
+
@gapi.configuration.load.update! preserve_ascii_control_characters: val
|
|
2801
|
+
end
|
|
2802
|
+
|
|
2755
2803
|
def cancel
|
|
2756
2804
|
raise "not implemented in #{self.class}"
|
|
2757
2805
|
end
|
|
@@ -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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
@@ -1382,6 +1458,20 @@ module Google
|
|
|
1382
1458
|
# service. Calls made on this object will raise errors if the resource
|
|
1383
1459
|
# does not exist. Default is `false`. Optional.
|
|
1384
1460
|
# @param [String] project_id The GCP Project where the dataset lives.
|
|
1461
|
+
# @param [Integer] access_policy_version Optional. The version of the
|
|
1462
|
+
# provided access policy schema. Valid values are `0`, `1`, and `3`.
|
|
1463
|
+
# Requests specifying an invalid value will be rejected. This
|
|
1464
|
+
# version refers to the schema version of the access policy and not
|
|
1465
|
+
# the version of access policy. This field's value can be equal or
|
|
1466
|
+
# more than the access policy schema provided in the request. For
|
|
1467
|
+
# example, requests with conditional access policy binding in datasets
|
|
1468
|
+
# must specify version `3`. But dataset with no conditional role
|
|
1469
|
+
# bindings in access policy may specify any valid value or leave the
|
|
1470
|
+
# field unset. If unset or if `0` or `1` value is used for dataset with
|
|
1471
|
+
# conditional bindings, request will be rejected. This field will be
|
|
1472
|
+
# mapped to
|
|
1473
|
+
# [IAM Policy version](https://cloud.google.com/iam/docs/policies#versions)
|
|
1474
|
+
# and will be used to set policy in IAM.
|
|
1385
1475
|
#
|
|
1386
1476
|
# @return [Google::Cloud::Bigquery::Dataset, nil] Returns `nil` if the
|
|
1387
1477
|
# dataset does not exist.
|
|
@@ -1409,12 +1499,12 @@ module Google
|
|
|
1409
1499
|
#
|
|
1410
1500
|
# dataset = bigquery.dataset "my_dataset", skip_lookup: true
|
|
1411
1501
|
#
|
|
1412
|
-
def dataset dataset_id, skip_lookup: nil, project_id: nil
|
|
1502
|
+
def dataset dataset_id, skip_lookup: nil, project_id: nil, access_policy_version: nil
|
|
1413
1503
|
ensure_service!
|
|
1414
1504
|
project_id ||= project
|
|
1415
1505
|
return Dataset.new_reference project_id, dataset_id, service if skip_lookup
|
|
1416
|
-
gapi = service.get_project_dataset project_id, dataset_id
|
|
1417
|
-
Dataset.from_gapi gapi, service
|
|
1506
|
+
gapi = service.get_project_dataset project_id, dataset_id, access_policy_version: access_policy_version
|
|
1507
|
+
Dataset.from_gapi gapi, service, access_policy_version: access_policy_version
|
|
1418
1508
|
rescue Google::Cloud::NotFoundError
|
|
1419
1509
|
nil
|
|
1420
1510
|
end
|
|
@@ -1433,6 +1523,20 @@ module Google
|
|
|
1433
1523
|
# @param [String] location The geographic location where the dataset
|
|
1434
1524
|
# should reside. Possible values include `EU` and `US`. The default
|
|
1435
1525
|
# value is `US`.
|
|
1526
|
+
# @param [Integer] access_policy_version Optional. The version of the
|
|
1527
|
+
# provided access policy schema. Valid values are `0`, `1`, and `3`.
|
|
1528
|
+
# Requests specifying an invalid value will be rejected. This
|
|
1529
|
+
# version refers to the schema version of the access policy and not
|
|
1530
|
+
# the version of access policy. This field's value can be equal or
|
|
1531
|
+
# more than the access policy schema provided in the request. For
|
|
1532
|
+
# example, requests with conditional access policy binding in datasets
|
|
1533
|
+
# must specify version `3`. But dataset with no conditional role
|
|
1534
|
+
# bindings in access policy may specify any valid value or leave the
|
|
1535
|
+
# field unset. If unset or if `0` or `1` value is used for dataset with
|
|
1536
|
+
# conditional bindings, request will be rejected. This field will be
|
|
1537
|
+
# mapped to
|
|
1538
|
+
# [IAM Policy version](https://cloud.google.com/iam/docs/policies#versions)
|
|
1539
|
+
# and will be used to set policy in IAM.
|
|
1436
1540
|
# @yield [access] a block for setting rules
|
|
1437
1541
|
# @yieldparam [Google::Cloud::Bigquery::Dataset] access the object
|
|
1438
1542
|
# accepting rules
|
|
@@ -1465,7 +1569,7 @@ module Google
|
|
|
1465
1569
|
# end
|
|
1466
1570
|
#
|
|
1467
1571
|
def create_dataset dataset_id, name: nil, description: nil,
|
|
1468
|
-
expiration: nil, location: nil
|
|
1572
|
+
expiration: nil, location: nil, access_policy_version: nil
|
|
1469
1573
|
ensure_service!
|
|
1470
1574
|
|
|
1471
1575
|
new_ds = Google::Apis::BigqueryV2::Dataset.new(
|
|
@@ -1488,8 +1592,8 @@ module Google
|
|
|
1488
1592
|
updater.check_for_mutated_access!
|
|
1489
1593
|
end
|
|
1490
1594
|
|
|
1491
|
-
gapi = service.insert_dataset new_ds
|
|
1492
|
-
Dataset.from_gapi gapi, service
|
|
1595
|
+
gapi = service.insert_dataset new_ds, access_policy_version: access_policy_version
|
|
1596
|
+
Dataset.from_gapi gapi, service, access_policy_version: access_policy_version
|
|
1493
1597
|
end
|
|
1494
1598
|
|
|
1495
1599
|
##
|