Write a dataset to a given format and partitioning. Parameters ---------- data : Dataset, Table/RecordBatch, RecordBatchReader, list of \ Table/RecordBatch, or iterable of RecordBatch The data to write. This can be a Dataset instance or in-memory Arrow data. If an i
(data, base_dir, *, basename_template=None, format=None,
partitioning=None, partitioning_flavor=None,
schema=None, filesystem=None, file_options=None, use_threads=True,
preserve_order=False, max_partitions=None, max_open_files=None,
max_rows_per_file=None, min_rows_per_group=None,
max_rows_per_group=None, file_visitor=None,
existing_data_behavior='error', create_dir=True)
| 844 | |
| 845 | |
| 846 | def write_dataset(data, base_dir, *, basename_template=None, format=None, |
| 847 | partitioning=None, partitioning_flavor=None, |
| 848 | schema=None, filesystem=None, file_options=None, use_threads=True, |
| 849 | preserve_order=False, max_partitions=None, max_open_files=None, |
| 850 | max_rows_per_file=None, min_rows_per_group=None, |
| 851 | max_rows_per_group=None, file_visitor=None, |
| 852 | existing_data_behavior='error', create_dir=True): |
| 853 | """ |
| 854 | Write a dataset to a given format and partitioning. |
| 855 | |
| 856 | Parameters |
| 857 | ---------- |
| 858 | data : Dataset, Table/RecordBatch, RecordBatchReader, list of \ |
| 859 | Table/RecordBatch, or iterable of RecordBatch |
| 860 | The data to write. This can be a Dataset instance or |
| 861 | in-memory Arrow data. If an iterable is given, the schema must |
| 862 | also be given. |
| 863 | base_dir : str |
| 864 | The root directory where to write the dataset. |
| 865 | basename_template : str, optional |
| 866 | A template string used to generate basenames of written data files. |
| 867 | The token '{i}' will be replaced with an automatically incremented |
| 868 | integer. If not specified, it defaults to |
| 869 | "part-{i}." + format.default_extname |
| 870 | format : FileFormat or str |
| 871 | The format in which to write the dataset. Currently supported: |
| 872 | "parquet", "ipc"/"arrow"/"feather", and "csv". If a FileSystemDataset |
| 873 | is being written and `format` is not specified, it defaults to the |
| 874 | same format as the specified FileSystemDataset. When writing a |
| 875 | Table or RecordBatch, this keyword is required. |
| 876 | partitioning : Partitioning or list[str], optional |
| 877 | The partitioning scheme specified with the ``partitioning()`` |
| 878 | function or a list of field names. When providing a list of |
| 879 | field names, you can use ``partitioning_flavor`` to drive which |
| 880 | partitioning type should be used. |
| 881 | partitioning_flavor : str, optional |
| 882 | One of the partitioning flavors supported by |
| 883 | ``pyarrow.dataset.partitioning``. If omitted will use the |
| 884 | default of ``partitioning()`` which is directory partitioning. |
| 885 | schema : Schema, optional |
| 886 | filesystem : FileSystem, optional |
| 887 | file_options : pyarrow.dataset.FileWriteOptions, optional |
| 888 | FileFormat specific write options, created using the |
| 889 | ``FileFormat.make_write_options()`` function. |
| 890 | use_threads : bool, default True |
| 891 | Write files in parallel. If enabled, then maximum parallelism will be |
| 892 | used determined by the number of available CPU cores. Using multiple |
| 893 | threads may change the order of rows in the written dataset if |
| 894 | preserve_order is set to False. |
| 895 | preserve_order : bool, default False |
| 896 | Preserve the order of rows. If enabled, order of rows in the dataset are |
| 897 | guaranteed to be preserved even if use_threads is set to True. This may |
| 898 | cause notable performance degradation. |
| 899 | max_partitions : int, default 1024 |
| 900 | Maximum number of partitions any batch may be written into. |
| 901 | max_open_files : int, default 1024 |
| 902 | If greater than 0 then this will limit the maximum number of |
| 903 | files that can be left open. If an attempt is made to open |
nothing calls this directly
no test coverage detected