@@ -2456,6 +2456,7 @@ def load_table_from_dataframe(
2456
2456
project : str = None ,
2457
2457
job_config : LoadJobConfig = None ,
2458
2458
parquet_compression : str = "snappy" ,
2459
+ parquet_use_compliant_nested_type : bool = True ,
2459
2460
timeout : float = DEFAULT_TIMEOUT ,
2460
2461
) -> job .LoadJob :
2461
2462
"""Upload the contents of a table from a pandas DataFrame.
@@ -2519,18 +2520,34 @@ def load_table_from_dataframe(
2519
2520
:attr:`~google.cloud.bigquery.job.SourceFormat.PARQUET` are
2520
2521
supported.
2521
2522
parquet_compression (Optional[str]):
2522
- [Beta] The compression method to use if intermittently
2523
- serializing ``dataframe`` to a parquet file.
2524
-
2525
- The argument is directly passed as the ``compression``
2526
- argument to the underlying ``pyarrow.parquet.write_table()``
2527
- method (the default value "snappy" gets converted to uppercase).
2528
- https://arrow.apache.org/docs/python/generated/pyarrow.parquet.write_table.html#pyarrow-parquet-write-table
2529
-
2530
- If the job config schema is missing, the argument is directly
2531
- passed as the ``compression`` argument to the underlying
2532
- ``DataFrame.to_parquet()`` method.
2533
- https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet
2523
+ [Beta] The compression method to use if intermittently
2524
+ serializing ``dataframe`` to a parquet file.
2525
+
2526
+ The argument is directly passed as the ``compression``
2527
+ argument to the underlying ``pyarrow.parquet.write_table()``
2528
+ method (the default value "snappy" gets converted to uppercase).
2529
+ https://arrow.apache.org/docs/python/generated/pyarrow.parquet.write_table.html#pyarrow-parquet-write-table
2530
+
2531
+ If the job config schema is missing, the argument is directly
2532
+ passed as the ``compression`` argument to the underlying
2533
+ ``DataFrame.to_parquet()`` method.
2534
+ https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet
2535
+ parquet_use_compliant_nested_type (bool):
2536
+ Whether the ``pyarrow.parquet.write_table`` serializing method should write
2537
+ compliant Parquet nested type (lists). Defaults to ``True``.
2538
+
2539
+ The argument is directly passed as the ``use_compliant_nested_type``
2540
+ argument to the underlying ``pyarrow.parquet.write_table()``
2541
+ method.
2542
+ https://arrow.apache.org/docs/python/generated/pyarrow.parquet.write_table.html#pyarrow-parquet-write-table
2543
+
2544
+ If the job config schema is missing, the argument is directly
2545
+ passed as an additonal ``kwarg`` argument to the underlying
2546
+ ``DataFrame.to_parquet()`` method.
2547
+ https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_parquet.html#pandas.DataFrame.to_parquet
2548
+
2549
+ This argument is only present to allow for backwards compatibility with
2550
+ tables created using an old version of this method.
2534
2551
timeout (Optional[float]):
2535
2552
The number of seconds to wait for the underlying HTTP transport
2536
2553
before using ``retry``.
@@ -2647,9 +2664,15 @@ def load_table_from_dataframe(
2647
2664
job_config .schema ,
2648
2665
tmppath ,
2649
2666
parquet_compression = parquet_compression ,
2667
+ parquet_use_compliant_nested_type = parquet_use_compliant_nested_type ,
2650
2668
)
2651
2669
else :
2652
- dataframe .to_parquet (tmppath , compression = parquet_compression )
2670
+ dataframe .to_parquet (
2671
+ tmppath ,
2672
+ engine = "pyarrow" ,
2673
+ compression = parquet_compression ,
2674
+ use_compliant_nested_type = parquet_use_compliant_nested_type ,
2675
+ )
2653
2676
2654
2677
else :
2655
2678
0 commit comments