write
The write
method will write a table to a standard Parquet file.
Syntax
write(table, outputFile)
write(table, outputFile, parquetInstructions)
Parameters
Parameter | Type | Description |
---|---|---|
table | Table | The table to write to file. |
outputFile | String | Path name of the file where the table will be stored. The file name should end with the |
parquetInstructions optional | String | Optional instructions for customizations while writing. Valid values are:
|
Returns
A Parquet file located in the specified path.
Examples
note
All examples in this document write data to the /data
directory in Deephaven. For more information on this directory and how it relates to your local file system, see Docker data volumes.
Single Parquet file
In this example, write
writes the source table to /data/output.parquet
.
from deephaven import new_table
from deephaven.column import string_col, int_col
from deephaven.parquet import write
source = new_table([
string_col("X", ["A", "B", "B", "C", "B", "A", "B", "B", "C"]),
int_col("Y", [2, 4, 2, 1, 2, 3, 4, 2, 3]),
int_col("Z", [55, 76, 20, 4, 230, 50, 73, 137, 214]),
])
write(source, "/data/output.parquet")
- source
Compression codec
In this example, write
writes the source table /data/output_GZIP.parquet
with GZIP
compression.
from deephaven import new_table
from deephaven.column import string_col, int_col
from deephaven.parquet import write
source = new_table([
string_col("X", ["A", "B", "B", "C", "B", "A", "B", "B", "C"]),
int_col("Y", [2, 4, 2, 1, 2, 3, 4, 2, 3]),
int_col("Z", [55, 76, 20, 4, 230, 50, 73, 137, 214]),
])
write(source, "/data/output_GZIP.parquet", compression_codec_name="GZIP")
- source