在jupy上使用gbq时删除所有日志

2024-06-13 09:26:46 发布

您现在位置:Python中文网/ 问答频道 /正文

在jupyter上使用gbq时是否可以删除所有日志?你知道吗

示例:

sql = """
SELECT country_name, alpha_2_code
FROM [bigquery-public-data:utility_us.country_code_iso]
WHERE alpha_2_code LIKE 'Z%'
"""
for i in range(10):
    df = pandas_gbq.read_gbq(
        sql,
        project_id=project_id,
        # Set the dialect to "legacy" to use legacy SQL syntax. As of
        # pandas-gbq version 0.10.0, the default dialect is "standard".
        dialect="legacy",
    )

结果:

Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.08rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.06rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  8.72rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  6.15rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.24rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  8.40rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.27rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.18rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.55rows/s]
Downloading: 100%|██████████| 3/3 [00:00<00:00,  3.26rows/s]

我希望结果一无所获。 谢谢


Tags: thetoalphaprojectidpandassqllegacy
1条回答
网友
1楼 · 发布于 2024-06-13 09:26:46

这些不是日志,我还认为有一段时间,但在玩了logging库之后,无法删除消息,这是文档推荐给handle log verbosity的消息,但没有成功。你知道吗

我跳到code并意识到在pandas_gbq.read_gbq()function处有一个progress_bar_type参数,必须设置为None才能消除要删除的消息。See the options.

因此,当您调用函数时,它应该如下所示:

pandas_gbq.read_gbq(sql, project_id=project_id, dialect="legacy", progress_bar_type=None)

相关问题 更多 >