Skip to Content
Data I/OExport Data

Export Data

The COPY TO command enables direct export of query results to various file formats. Currently, CSV export is fully supported, with additional formats available through the Extension framework as they are developed.

Copy to CSV

The COPY TO clause can export query results to a CSV file and is used as follows:

COPY (MATCH (p:person) RETURN p.*) TO 'person.csv' (header=true);

The CSV file consists of the following fields:

p.id|p.name|p.age 1|marko|29 2|vadas|27 4|josh|32 6|peter|35

Complex types, such as vertices and edges, will be output in their JSON-formatted strings.

Available parameters are:

ParameterDescriptionDefault
HEADERWhether to output a header row.false
DELIM or DELIMITERCharacter that separates fields in the CSV.|

Another example is shown below.

COPY (MATCH (:person)-[e:knows]->(:person) RETURN e) TO 'person_knows_person.csv' (header=true);

This outputs the following results to person_knows_person.csv:

e {'_SRC': '0:0', '_DST': '0:1', '_LABEL': 'knows', 'weight': 0.500000} {'_SRC': '0:0', '_DST': '0:2', '_LABEL': 'knows', 'weight': 1.000000}

Additional Export Formats

NeuG is expanding export capabilities through the Extension framework. Planned export formats include:

  • Parquet Export: High-performance columnar format for analytics and data science workflows
  • DataFrame Integration: Direct export to pandas DataFrames and other data science tools

See the Extensions page for the latest supported formats.

Export Best Practices

  • Large Result Sets: Use LIMIT clauses to avoid memory issues when exporting large datasets
  • Data Types: Complex graph objects (nodes/edges) are exported as JSON strings for maximum compatibility
  • File Paths: Ensure the target directory exists and is writable before running export commands