Skip to content

Commit

Permalink
[WVuGDROz] Allow cypher.export.schema return using a stream (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
gem-neo4j authored May 13, 2024
1 parent f6605a4 commit 2527b16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions core/src/main/java/apoc/export/cypher/ExportCypher.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ public Stream<DataProgressInfo> schema(
@Name(value = "config", defaultValue = "{}") Map<String, Object> config) {
if (Util.isNullOrEmpty(fileName)) fileName = null;
String source = String.format("database: nodes(%d), rels(%d)", Util.nodeCount(tx), Util.relCount(tx));
// streamStatements
config.put("stream", false);
config.put("streamStatements", false);
return exportCypher(fileName, source, new DatabaseSubGraph(tx), new ExportConfig(config), true);
}

Expand Down Expand Up @@ -195,7 +192,7 @@ private void doExport(
ExportFileManager cypherFileManager) {
MultiStatementCypherSubGraphExporter exporter = new MultiStatementCypherSubGraphExporter(graph, c, db);

if (onlySchema) exporter.exportOnlySchema(cypherFileManager, c);
if (onlySchema) exporter.exportOnlySchema(cypherFileManager, reporter, c);
else exporter.export(c, reporter, cypherFileManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import apoc.export.cypher.formatter.CypherFormatterUtils;
import apoc.export.util.ExportConfig;
import apoc.export.util.ExportFormat;
import apoc.export.util.ProgressReporter;
import apoc.export.util.Reporter;
import apoc.util.Util;
import apoc.util.collection.Iterables;
Expand Down Expand Up @@ -118,10 +119,11 @@ public void export(ExportConfig config, Reporter reporter, ExportFileManager cyp
reporter.done();
}

public void exportOnlySchema(ExportFileManager cypherFileManager, ExportConfig config) {
public void exportOnlySchema(ExportFileManager cypherFileManager, ProgressReporter reporter, ExportConfig config) {
PrintWriter schemaWriter = cypherFileManager.getPrintWriter("schema");
exportSchema(schemaWriter, config);
schemaWriter.close();
reporter.done();
}

// ---- Nodes ----
Expand Down

0 comments on commit 2527b16

Please sign in to comment.