From 326e674a24fc7e057e213596df92f0c4a8225f9e Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Tue, 2 Nov 2021 16:26:14 -0600 Subject: [PATCH] docs: clarify `table_schema` (#383) 1. There must be an input dataframe column for every desired output table column. 2. The types given in table_schema must be BigQuery types (strings). - [x] closes #382 - [x] tests added / passed - [x] passes `nox -s blacken lint` --- pandas_gbq/gbq.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas_gbq/gbq.py b/pandas_gbq/gbq.py index 5c6ae457..87c2327c 100644 --- a/pandas_gbq/gbq.py +++ b/pandas_gbq/gbq.py @@ -927,11 +927,12 @@ def to_gbq( table_schema : list of dicts, optional List of BigQuery table fields to which according DataFrame columns conform to, e.g. ``[{'name': 'col1', 'type': - 'STRING'},...]``. + 'STRING'},...]``. The ``type`` values must be BigQuery type names. - If ``table_schema`` is provided, it may contain all or a subset of DataFrame columns. If a subset is provided, the rest will be - inferred from the DataFrame dtypes. + inferred from the DataFrame dtypes. If ``table_schema`` contains + columns not in the DataFrame, they'll be ignored. - If ``table_schema`` is **not** provided, it will be generated according to dtypes of DataFrame columns. See `Inferring the Table Schema