Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bigframes/_config/compute_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ class ComputeOptions:
"""
Encapsulates configuration for compute options.

**Examples:**

>>> import bigframes.pandas as bpd
>>> df = bpd.read_gbq("bigquery-public-data.ml_datasets.penguins")

>>> bpd.options.compute.maximum_bytes_billed = 500
>>> # df.to_pandas() # this should fail
google.api_core.exceptions.InternalServerError: 500 Query exceeded limit for bytes billed: 500. 10485760 or higher required.

>>> bpd.options.compute.maximum_bytes_billed = None # reset option

Attributes:
maximum_bytes_billed (int, Options):
Limits the bytes billed for query jobs. Queries that will have
Expand Down
20 changes: 20 additions & 0 deletions third_party/bigframes_vendored/pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@
display_options_doc = """
Encapsulates configuration for displaying objects.

**Examples:**

Define Repr mode to "deferred" will prevent job execution in repr.
>>> import bigframes.pandas as bpd
>>> df = bpd.read_gbq("bigquery-public-data.ml_datasets.penguins")

>>> bpd.options.display.repr_mode = "deferred"
>>> df.head(20) # will no longer run the job
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does user run it then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 33 tells to call to_pandas()

Computation deferred. Computation will process 28.9 kB

Users can also get a dry run of the job by accessing the query_job property before they've run the job. This will return a dry run instance of the job they can inspect.
>>> df.query_job.total_bytes_processed
28947

User can execute the job by calling .to_pandas()
>>> # df.to_pandas()

Reset option
>>> bpd.options.display.repr_mode = "head"

Attributes:
max_columns (int, default 20):
If `max_columns` is exceeded, switch to truncate view.
Expand Down