Export Data to a CSV

Deephaven supports saving data to a CSV file. To export the results of a query to a CSV, use the writeCsv method. The sole argument to the writeCsv method is the path to which the file should be written. However, you do need to import the TableTools class, as demonstrated below.

import com.illumon.iris.db.tables.utils.TableTools

writeCsv(tableToExport, "/mnt/exportPath/myResults.csv")
from deephaven import *

ttools.writeCsv(tableToExport, "/mnt/exportPath/myResults.csv")

By default null values in the table will be exported as (null). Users can opt to insert blanks instead by adding an additional parameter:

writeCsv(sourcePath, destPath, nullsAsEmpty, columns)

writeCsv(tableToExport, "/mnt/exportPath/myResults.csv", true)

You can also specify any character that is not a new line character to be used as the delimiter:

writeCsv(sourceTable, destPath, compressed, timeZone, nullsAsEmpty, separator, columns)

For example, the following queries configures the CSV to use a | as the delimiter:

import com.illumon.iris.db.tables.utils.DBTimeZone

writeCsv(tableToExport, "/mnt/exportPath/myResults.csv", false, DBTimeZone.TZ_DEFAULT, false, '|')

Note

See also: TableTools JavaDocs or PyDocs for more information on writeCsv.

Caution

Important: The path is evaluated on the Deephaven query server. If you do not have access to the query server, you may create a CSV from the Deephaven console instead. This is accomplished by right-clicking on the header row of a table, and then selecting Export to CSV from the drop-down menu. Deephaven supports saving data to a CSV file. To export the results of a query to a CSV, use the writeCsv method. The sole argument to the writeCsv method is the path to which the file should be written. However, you do need to import the TableTools class, as demonstrated below.

import com.illumon.iris.db.tables.utils.TableTools

writeCsv(tableToExport, "/mnt/exportPath/myResults.csv")
from deephaven import *

ttools.writeCsv(tableToExport, "/mnt/exportPath/myResults.csv")

By default null values in the table will be exported as (null). Users can opt to insert blanks instead by adding an additional parameter:

public static void writeCsv(String sourcePath, String destPath, boolean nullsAsEmpty, String... columns)

writeCsv(tableToExport, "/mnt/exportPath/myResults.csv", true)

Note

See also: TableTools JavaDocs or PyDocs for more information on writeCsv.

Caution

Important: The path is evaluated on the Deephaven query server. If you do not have access to the query server, you may create a CSV from the Deephaven console instead. This is accomplished by right-clicking on the header row of a table, and then selecting Export to CSV from the drop-down menu.