@@ -29,7 +29,7 @@ class ComputeOptions: |
29 | 29 | >>> df = bpd.read_gbq("bigquery-public-data.ml_datasets.penguins") |
30 | 30 |
|
31 | 31 | >>> bpd.options.compute.maximum_bytes_billed = 500 |
32 | | - >>> # df.to_pandas() # this should fail |
| 32 | + >>> df.to_pandas() # this should fail # doctest: +SKIP |
33 | 33 | google.api_core.exceptions.InternalServerError: 500 Query exceeded limit for bytes billed: 500. 10485760 or higher required. |
34 | 34 |
|
35 | 35 | >>> bpd.options.compute.maximum_bytes_billed = None # reset option |
@@ -53,68 +53,112 @@ class ComputeOptions: |
53 | 53 | >>> del bpd.options.compute.extra_query_labels["test1"] |
54 | 54 | >>> bpd.options.compute.extra_query_labels |
55 | 55 | {'test2': 'abc', 'test3': False} |
56 | | -
|
57 | | - Attributes: |
58 | | - ai_ops_confirmation_threshold (int | None): |
59 | | - Guards against unexpected processing of large amount of rows by semantic operators. |
60 | | - If the number of rows exceeds the threshold, the user will be asked to confirm |
61 | | - their operations to resume. The default value is 0. Set the value to None |
62 | | - to turn off the guard. |
63 | | -
|
64 | | - ai_ops_threshold_autofail (bool): |
65 | | - Guards against unexpected processing of large amount of rows by semantic operators. |
66 | | - When set to True, the operation automatically fails without asking for user inputs. |
67 | | -
|
68 | | - allow_large_results (bool | None): |
69 | | - Specifies whether query results can exceed 10 GB. Defaults to False. Setting this |
70 | | - to False (the default) restricts results to 10 GB for potentially faster execution; |
71 | | - BigQuery will raise an error if this limit is exceeded. Setting to True removes |
72 | | - this result size limit. |
73 | | -
|
74 | | - enable_multi_query_execution (bool | None): |
75 | | - If enabled, large queries may be factored into multiple smaller queries |
76 | | - in order to avoid generating queries that are too complex for the query |
77 | | - engine to handle. However this comes at the cost of increase cost and latency. |
78 | | -
|
79 | | - extra_query_labels (Dict[str, Any] | None): |
80 | | - Stores additional custom labels for query configuration. |
81 | | -
|
82 | | - maximum_bytes_billed (int | None): |
83 | | - Limits the bytes billed for query jobs. Queries that will have |
84 | | - bytes billed beyond this limit will fail (without incurring a |
85 | | - charge). If unspecified, this will be set to your project default. |
86 | | - See `maximum_bytes_billed`: https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig#google_cloud_bigquery_job_QueryJobConfig_maximum_bytes_billed. |
87 | | -
|
88 | | - maximum_result_rows (int | None): |
89 | | - Limits the number of rows in an execution result. When converting |
90 | | - a BigQuery DataFrames object to a pandas DataFrame or Series (e.g., |
91 | | - using ``.to_pandas()``, ``.peek()``, ``.__repr__()``, direct |
92 | | - iteration), the data is downloaded from BigQuery to the client |
93 | | - machine. This option restricts the number of rows that can be |
94 | | - downloaded. If the number of rows to be downloaded exceeds this |
95 | | - limit, a ``bigframes.exceptions.MaximumResultRowsExceeded`` |
96 | | - exception is raised. |
97 | | -
|
98 | | - semantic_ops_confirmation_threshold (int | None): |
99 | | - .. deprecated:: 1.42.0 |
100 | | - Semantic operators are deprecated. Please use AI operators instead |
101 | | -
|
102 | | - semantic_ops_threshold_autofail (bool): |
103 | | - .. deprecated:: 1.42.0 |
104 | | - Semantic operators are deprecated. Please use AI operators instead |
105 | 56 | """ |
106 | 57 |
|
107 | 58 | ai_ops_confirmation_threshold: Optional[int] = 0 |
| 59 | + """ |
| 60 | + Guards against unexpected processing of large amount of rows by semantic operators. |
| 61 | +
|
| 62 | + If the number of rows exceeds the threshold, the user will be asked to confirm |
| 63 | + their operations to resume. The default value is 0. Set the value to None |
| 64 | + to turn off the guard. |
| 65 | +
|
| 66 | + Returns: |
| 67 | + Optional[int]: Number of rows. |
| 68 | + """ |
| 69 | + |
108 | 70 | ai_ops_threshold_autofail: bool = False |
| 71 | + """ |
| 72 | + Guards against unexpected processing of large amount of rows by semantic operators. |
| 73 | +
|
| 74 | + When set to True, the operation automatically fails without asking for user inputs. |
| 75 | +
|
| 76 | + Returns: |
| 77 | + bool: True if the guard is enabled. |
| 78 | + """ |
| 79 | + |
109 | 80 | allow_large_results: Optional[bool] = None |
| 81 | + """ |
| 82 | + Specifies whether query results can exceed 10 GB. |
| 83 | +
|
| 84 | + Defaults to False. Setting this to False (the default) restricts results to |
| 85 | + 10 GB for potentially faster execution; BigQuery will raise an error if this |
| 86 | + limit is exceeded. Setting to True removes this result size limit. |
| 87 | +
|
| 88 | +
|
| 89 | + Returns: |
| 90 | + bool | None: True if results > 10 GB are enabled. |
| 91 | + """ |
110 | 92 | enable_multi_query_execution: bool = False |
| 93 | + """ |
| 94 | + If enabled, large queries may be factored into multiple smaller queries. |
| 95 | +
|
| 96 | + This is in order to avoid generating queries that are too complex for the |
| 97 | + query engine to handle. However this comes at the cost of increase cost and |
| 98 | + latency. |
| 99 | +
|
| 100 | +
|
| 101 | + Returns: |
| 102 | + bool | None: True if enabled. |
| 103 | + """ |
| 104 | + |
111 | 105 | extra_query_labels: Dict[str, Any] = dataclasses.field( |
112 | 106 | default_factory=dict, init=False |
113 | 107 | ) |
| 108 | + """ |
| 109 | + Stores additional custom labels for query configuration. |
| 110 | +
|
| 111 | + Returns: |
| 112 | + Dict[str, Any] | None: Additional labels. |
| 113 | + """ |
| 114 | + |
114 | 115 | maximum_bytes_billed: Optional[int] = None |
| 116 | + """ |
| 117 | + Limits the bytes billed for query jobs. |
| 118 | +
|
| 119 | + Queries that will have bytes billed beyond this limit will fail (without |
| 120 | + incurring a charge). If unspecified, this will be set to your project |
| 121 | + default. See `maximum_bytes_billed`: |
| 122 | + https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig#google_cloud_bigquery_job_QueryJobConfig_maximum_bytes_billed. |
| 123 | +
|
| 124 | + Returns: |
| 125 | + int | None: Number of bytes, if set. |
| 126 | + """ |
| 127 | + |
115 | 128 | maximum_result_rows: Optional[int] = None |
| 129 | + """ |
| 130 | + Limits the number of rows in an execution result. |
| 131 | +
|
| 132 | + When converting a BigQuery DataFrames object to a pandas DataFrame or Series |
| 133 | + (e.g., using ``.to_pandas()``, ``.peek()``, ``.__repr__()``, direct |
| 134 | + iteration), the data is downloaded from BigQuery to the client machine. This |
| 135 | + option restricts the number of rows that can be downloaded. If the number |
| 136 | + of rows to be downloaded exceeds this limit, a |
| 137 | + ``bigframes.exceptions.MaximumResultRowsExceeded`` exception is raised. |
| 138 | +
|
| 139 | + Returns: |
| 140 | + int | None: Number of rows, if set. |
| 141 | + """ |
| 142 | + |
116 | 143 | semantic_ops_confirmation_threshold: Optional[int] = 0 |
| 144 | + """ |
| 145 | + Deprecated. |
| 146 | +
|
| 147 | + .. deprecated:: 1.42.0 |
| 148 | + Semantic operators are deprecated. Please use the functions in |
| 149 | + :mod:`bigframes.bigquery.ai` instead. |
| 150 | +
|
| 151 | + """ |
| 152 | + |
117 | 153 | semantic_ops_threshold_autofail = False |
| 154 | + """ |
| 155 | + Deprecated. |
| 156 | +
|
| 157 | + .. deprecated:: 1.42.0 |
| 158 | + Semantic operators are deprecated. Please use the functions in |
| 159 | + :mod:`bigframes.bigquery.ai` instead. |
| 160 | +
|
| 161 | + """ |
118 | 162 |
|
119 | 163 | def assign_extra_query_labels(self, **kwargs: Any) -> None: |
120 | 164 | """ |
|