Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

ad unit statement error.

オープン
#546 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

関連するエントリーポイントは report_downloader.WaitForReport と DownloadReportToFile です。まず、pandas の読み取りステップから reportQuery ステートメントと adUnitView 設定を切り分けます。フィルタリングされたレポートが EmptyDataError ではなく、要求された ad unit ID を含む読み取り可能な CSV を生成すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hi,
I am trying to run a report by filtering the data with Ad unit ID. However when I set 'adUnitView':'HIERARCHICAL' the code produces zero data. When I remove 'statement': ad_unit_filter_statement, the code works but brings all data of all ad unit IDs.

How can I rewrite the ad_unit_filter_statement?

The error

EmptyDataError: No columns to parse from file

The Code

ad_unit_ids = [1111, 2222]

ad_unit_filter_statement = {
    'query': 'WHERE AD_UNIT_ID IN (%s)' % ','.join(map(str, ad_unit_ids))
}

report_job = {
    'reportQuery': {
        'dimensions': [
            'DATE',
            'ADVERTISER_ID'       ,'ADVERTISER_NAME',
            'ORDER_ID'            ,'ORDER_NAME',
            'LINE_ITEM_ID'        ,'LINE_ITEM_NAME',
            'AD_UNIT_ID'          ,'AD_UNIT_NAME', 
            'DEVICE_CATEGORY_NAME','DEVICE_CATEGORY_ID'

        ],
        'columns': ['TOTAL_LINE_ITEM_LEVEL_IMPRESSIONS',
                    'TOTAL_LINE_ITEM_LEVEL_CLICKS',
                    'TOTAL_ACTIVE_VIEW_VIEWABLE_IMPRESSIONS'
                   ],
        'adUnitView':'HIERARCHICAL',
        'dateRangeType': 'CUSTOM_DATE',
        'startDate': first_date,
        'endDate': last_date,
        'statement': ad_unit_filter_statement
    }
}

report_job_id = report_downloader.WaitForReport(report_job)
export_format = 'CSV_DUMP'
directory='/home/sgocen/git_tree/xxx'
report_file = tempfile.NamedTemporaryFile(suffix='.csv', dir=directory, delete=False)
report_downloader.DownloadReportToFile(report_job_id, export_format, report_file, use_gzip_compression=False)
chunk_size = (16 * 1024) # chunk size used for report downloader
file_size = os.path.getsize(report_file.name)
df_report = pd.read_csv(report_file.name)
report_file.close() 
主要言語
Python
スター
749
フォーク
967
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googleads/googleads-python-lib のほかの issue

googleads/googleads-python-lib の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。