PyODPS exposes all SDK configuration options through odps.options. Set any option directly on this object before running operations, and PyODPS applies it globally for that session.
import odps
# Set an option
odps.options.connect_timeout = 30
# Read the current value
print(odps.options.connect_timeout) # 30
Configuration options
Options are grouped into three categories: general, data upload and download, and DataFrame.
General
| Option | Type | Description | Default |
|---|---|---|---|
end_point |
String | The MaxCompute endpoint. | None |
default_project |
String | The default project. | None |
log_view_host |
String | The hostname in the Logview URL. | None |
log_view_hours |
Integer | How long Logview retains logs, in hours. | 24 |
local_timezone |
Boolean or pytz timezone | The time zone used for datetime values. True uses the local system time zone, False uses UTC. A pytz timezone object is also accepted. |
None |
lifecycle |
Integer | The lifecycle applied to all tables. | None |
temp_lifecycle |
Integer | The lifecycle applied to temporary tables. | 1 |
biz_id |
String | The user ID. | None |
verbose |
Boolean | Whether to print log output. | False |
verbose_log |
Object | The log receiver. | None |
chunk_size |
Integer | The write buffer size. | 1496 |
retry_times |
Integer | The number of times to retry a failed request. | 4 |
connect_timeout |
Integer | The connection timeout. | 5 |
read_timeout |
Integer | The read timeout. | 120 |
pool_connections |
Integer | The number of connections cached in the connection pool. | 10 |
pool_maxsize |
Integer | The maximum size of the connection pool. | 10 |
completion_size |
Integer | The maximum number of items returned in object completion listings. | 10 |
notebook_repr_widget |
Boolean | Whether to render interactive graphs. | True |
sql.settings |
— | Global hints applied to all MaxCompute SQL runs. | None |
sql.use_odps2_extension |
Boolean | Whether to enable the MaxCompute 2.0 language extension. | False |
Network and retry settings
The following options work together to control connection behavior. Set them as a group when tuning for network conditions or high-throughput workloads:
import odps
# Increase timeouts and retry count for unstable networks
odps.options.connect_timeout = 30
odps.options.read_timeout = 300
odps.options.retry_times = 6
odps.options.pool_connections = 20
odps.options.pool_maxsize = 20
Data upload and download
| Option | Type | Description | Default |
|---|---|---|---|
tunnel.endpoint |
String | The Tunnel endpoint. | None |
tunnel.use_instance_tunnel |
Boolean | Whether to use Instance Tunnel to retrieve upload and download results. | True |
tunnel.limited_instance_tunnel |
Boolean | Whether to limit the number of records retrieved through Instance Tunnel. | True |
tunnel.string_as_binary |
Boolean | Whether to return STRING data as bytes instead of unicode. |
False |
DataFrame
| Option | Type | Description | Default |
|---|---|---|---|
interactive |
Boolean | Whether DataFrame is running in an interactive environment. | Based on the measured value |
df.analyze |
Boolean | Whether to enable non-MaxCompute built-in functions. | True |
df.optimize |
Boolean | Whether to enable all DataFrame optimizations. | True |
df.optimizes.pp |
Boolean | Whether to enable predicate pushdown optimization. | True |
df.optimizes.cp |
Boolean | Whether to enable column pruning optimization. | True |
df.optimizes.tunnel |
Boolean | Whether to enable Tunnel optimization for DataFrame. | True |
df.quote |
Boolean | Whether to wrap field and table names with backticks (`` ` ``) in the MaxCompute SQL backend. | True |
df.libraries |
— | The resource name of the third-party library used for DataFrame operations. | None |
该文章对您有帮助吗?