Skip to content

Support exporting to a local file via datafusion-cli #1214

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
It would be great / handy to use the datafusion-cli to transform data and write the transformed data to another format (e.g. convert from CSV to parquet, with possibly some transformations along the way.

Describe the solution you'd like
I propose adding the INTO clause like clickhouse or mysql;
https://clickhouse.com/docs/en/faq/integration/file-export/
https://dev.mysql.com/doc/refman/5.7/en/select-into.html

So one could export the contents of a table into a file using a command such as

SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV

Like #1213 I think this feature should be something that can be disabled for those implementations that do not want to allow their users to write to local files

Describe alternatives you've considered
We could potentially leave such features out of datafusion, as it exists in tools that use DataFusion such as https://github.com/roapi/roapi/tree/main/columnq-cli#format-conversion

Note that postgres uses the COPY command for the same purpose -- https://www.postgresql.org/docs/8.1/sql-copy.html

So like COPY foo to 'file'

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions