Skip to main content

Data import / export cheat sheet

CSV

from deephaven import read_csv, write_csv

result = read_csv(
path: str,
header: Dict[str, DataType] = None,
inference: Any = None,
headless: bool = False,
delimiter: str = ",",
quote: str = "\"",
ignore_surrounding_spaces: bool = True,
trim: bool = False,
charset: str = "utf-8")
write_csv(table, "/data/outputFile.csv")

Parquet

from deephaven import ParquetTools as pt

result = pt.readTable("/data/inputFile.parquet")
result = pt.readTable("/data/inputDirectory")
pt.writeTable(source, "/data/output.parquet") # source as any table in Deephaven

Kafka

from deephaven import ProduceKafka as pk

produceFromTable(kafkaProduceProperties, topic) # format
write_topic = pk.produceFromTable(source, {'bootstrap.servers': 'redpanda:29092'}, 'testTopic', pk.simple('X'), pk.IGNORE) # usage

from deephaven import ConsumeKafka as ck

result = ck.consumeToTable(kafkaConsumerProperties, topic) # format
result = ck.consumeToTable({'bootstrap.servers': 'redpanda:29092'}, 'testTopic') # usage