@@ -395,8 +395,6 @@ def cancel(self, client=None):
395
395
self ._set_properties (api_response )
396
396
397
397
398
-
399
-
400
398
class _LoadConfiguration (object ):
401
399
"""User-settable configuration options for load jobs."""
402
400
# None -> use server default.
@@ -817,232 +815,45 @@ def __init__(self, name, query, client):
817
815
self .query = query
818
816
self ._configuration = _QueryConfiguration ()
819
817
820
- @property
821
- def allow_large_results (self ):
822
- """Allow query to return arbitraily large result sets.
823
-
824
- See:
825
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.allowLargeResults
826
-
827
- :rtype: boolean, or ``NoneType``
828
- :returns: The value as set by the user, or None (the default).
829
- """
830
- return self ._configuration ._allow_large_results
831
-
832
- @allow_large_results .setter
833
- def allow_large_results (self , value ):
834
- """Update allow_large_results.
835
-
836
- :type value: boolean
837
- :param value: new allow_large_results
838
-
839
- :raises: ValueError for invalid value types.
840
- """
841
- if not isinstance (value , bool ):
842
- raise ValueError ("Pass a boolean" )
843
- self ._configuration ._allow_large_results = value
844
-
845
- @allow_large_results .deleter
846
- def allow_large_results (self ):
847
- """Delete allow_large_results."""
848
- del self ._configuration ._allow_large_results
849
-
850
- @property
851
- def create_disposition (self ):
852
- """Handling for missing destination table.
853
-
854
- See:
855
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy.createDisposition
856
-
857
- :rtype: string, or ``NoneType``
858
- :returns: The value as set by the user, or None (the default).
859
- """
860
- return self ._configuration ._create_disposition
861
-
862
- @create_disposition .setter
863
- def create_disposition (self , value ):
864
- """Update create_disposition.
865
-
866
- :type value: string
867
- :param value: allowed values for :class:`CreateDisposition`
868
- """
869
- CreateDisposition .validate (value ) # raises ValueError if invalid
870
- self ._configuration ._create_disposition = value
871
-
872
- @create_disposition .deleter
873
- def create_disposition (self ):
874
- """Delete create_disposition."""
875
- del self ._configuration ._create_disposition
876
-
877
- @property
878
- def default_dataset (self ):
879
- """Default dataset for unprefixed table names in query.
880
-
881
- See:
882
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.defaultDataset
883
-
884
- :rtype: :class:`gcloud.bigquery.dataset.Dataset`
885
- :returns: The value as set by the user, or None (the default).
886
- """
887
- return self ._configuration ._default_dataset
888
-
889
- @default_dataset .setter
890
- def default_dataset (self , value ):
891
- """Update default_dataset.
892
-
893
- :type value: :class:`gcloud.bigquery.dataset.Dataset`
894
- :param value: new default dataset.
895
- """
896
- if not isinstance (value , Dataset ):
897
- raise ValueError ('Pass a Dataset instance' )
898
- self ._configuration ._default_dataset = value
899
-
900
- @default_dataset .deleter
901
- def default_dataset (self ):
902
- """Delete default_dataset."""
903
- del self ._configuration ._default_dataset
904
-
905
- @property
906
- def destination_table (self ):
907
- """Table into which query results are writen.
908
-
909
- See:
910
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.destinationTable
911
-
912
- :rtype: :class:`gcloud.bigquery.table.Table`
913
- :returns: The value as set by the user, or None (the default).
914
- """
915
- return self ._configuration ._destination_table
916
-
917
- @destination_table .setter
918
- def destination_table (self , value ):
919
- """Update destination_table.
920
-
921
- :type value: :class:`gcloud.bigquery.table.Table`
922
- :param value: new default dataset.
923
- """
924
- if not isinstance (value , Table ):
925
- raise ValueError ('Pass a Table instance' )
926
- self ._configuration ._destination_table = value
927
-
928
- @destination_table .deleter
929
- def destination_table (self ):
930
- """Delete destination_table."""
931
- del self ._configuration ._destination_table
932
-
933
- @property
934
- def flatten_results (self ):
935
- """Flatten nested/repeated fields in results.
936
-
937
- See:
938
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.flattenResults
939
-
940
- :rtype: boolean, or ``NoneType``
941
- :returns: The value as set by the user, or None (the default).
942
- """
943
- return self ._configuration ._flatten_results
944
-
945
- @flatten_results .setter
946
- def flatten_results (self , value ):
947
- """Update flatten_results.
948
-
949
- :type value: boolean
950
- :param value: new flatten_results
951
-
952
- :raises: ValueError for invalid value types.
953
- """
954
- if not isinstance (value , bool ):
955
- raise ValueError ("Pass a boolean" )
956
- self ._configuration ._flatten_results = value
957
-
958
- @flatten_results .deleter
959
- def flatten_results (self ):
960
- """Delete flatten_results."""
961
- del self ._configuration ._flatten_results
962
-
963
- @property
964
- def priority (self ):
965
- """Handling for missing destination table.
966
-
967
- See:
968
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy.createDisposition
969
-
970
- :rtype: string, or ``NoneType``
971
- :returns: The value as set by the user, or None (the default).
972
- """
973
- return self ._configuration ._priority
974
-
975
- @priority .setter
976
- def priority (self , value ):
977
- """Update priority.
978
-
979
- :type value: string
980
- :param value: allowed values for :class:`QueryPriority`
981
- """
982
- QueryPriority .validate (value ) # raises ValueError if invalid
983
- self ._configuration ._priority = value
984
-
985
- @priority .deleter
986
- def priority (self ):
987
- """Delete priority."""
988
- del self ._configuration ._priority
989
-
990
- @property
991
- def use_query_cache (self ):
992
- """Set whether the query will be loaded from cache, if available.
993
-
994
- See:
995
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.useQueryCache
996
-
997
- :rtype: boolean, or ``NoneType``
998
- :returns: The value as set by the user, or None (the default).
999
- """
1000
- return self ._configuration ._use_query_cache
1001
-
1002
- @use_query_cache .setter
1003
- def use_query_cache (self , value ):
1004
- """Update use_query_cache.
1005
-
1006
- :type value: boolean
1007
- :param value: new use_query_cache
1008
-
1009
- :raises: ValueError for invalid value types.
1010
- """
1011
- if not isinstance (value , bool ):
1012
- raise ValueError ("Pass a boolean" )
1013
- self ._configuration ._use_query_cache = value
818
+ allow_large_results = _TypedProperty ('allow_large_results' , bool )
819
+ """See:
820
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.allowLargeResults
821
+ """
1014
822
1015
- @ use_query_cache . deleter
1016
- def use_query_cache ( self ) :
1017
- """Delete use_query_cache."""
1018
- del self . _configuration . _use_query_cache
823
+ create_disposition = CreateDisposition ( 'create_disposition' )
824
+ """See :
825
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.createDisposition
826
+ """
1019
827
1020
- @property
1021
- def write_disposition (self ):
1022
- """Allow rows with missing trailing commas for optional fields.
828
+ default_dataset = _TypedProperty ('default_dataset' , Dataset )
829
+ """See:
830
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.default_dataset
831
+ """
1023
832
1024
- See:
1025
- https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy.writeDisposition
833
+ destination_table = _TypedProperty ('destination_table' , Table )
834
+ """See:
835
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.destinationTable
836
+ """
1026
837
1027
- :rtype: string, or ``NoneType``
1028
- :returns: The value as set by the user, or None (the default).
1029
- """
1030
- return self . _configuration . _write_disposition
838
+ flatten_results = _TypedProperty ( 'flatten_results' , bool )
839
+ """See:
840
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.flattenResults
841
+ """
1031
842
1032
- @write_disposition .setter
1033
- def write_disposition (self , value ):
1034
- """Update write_disposition.
843
+ priority = QueryPriority ('priority' )
844
+ """See:
845
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.priority
846
+ """
1035
847
1036
- :type value: string
1037
- :param value: allowed values for :class:`WriteDisposition`.
1038
- """
1039
- WriteDisposition .validate (value ) # raises ValueError if invalid
1040
- self ._configuration ._write_disposition = value
848
+ use_query_cache = _TypedProperty ('use_query_cache' , bool )
849
+ """See:
850
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.useQueryCache
851
+ """
1041
852
1042
- @ write_disposition . deleter
1043
- def write_disposition ( self ) :
1044
- """Delete write_disposition."""
1045
- del self . _configuration . _write_disposition
853
+ write_disposition = WriteDisposition ( 'write_disposition' )
854
+ """See :
855
+ https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.query.writeDisposition
856
+ """
1046
857
1047
858
def _destination_table_resource (self ):
1048
859
if self .destination_table is not None :
0 commit comments