Skip to main content
The INTO clause writes query results to a file. You call it on the result of ->execute(), passing a target file query that describes the output format and path.

Fluent API

Pass a FileQuery object or a raw file query string to ->into(). The method returns a FileQuery with effective defaults applied, which you can use to read the written file back:

FQL syntax

Place INTO after the FROM clause (and any WHERE, ORDER BY, etc.):
INTO uses the same file query syntax as FROM:

Output format path semantics

The .query part of the file query has different meanings depending on the output format. When the query is omitted or set to *, each writer applies a sensible default:

Examples

Export to CSV

Export to JSON

Export to XML

Export to XLSX

Format-specific behavior

XLSX and ODS

Exported spreadsheets write the first row as bold column headers automatically. The header row contains the field names from your query.

JSON

When the query path is * or omitted, JSON output writes a flat array at the root level. Specifying a dotted path (e.g. .root.items) nests the array under the corresponding keys.

Writer defaults

When you call into(), the writer for the target format applies a default query path if none is specified. The into() method returns a FileQuery object that includes the effective query, so you can use it to read back the written file without guessing the path:
If you implement a custom Writer, your class must provide a getFileQuery(): FileQuery method that returns the FileQuery with any default query applied.

File handling behavior

If the target file already exists, FiQueLa throws a FileAlreadyExistsException and does not overwrite it. To export again, delete or rename the existing file first.
Missing output directories are created automatically — you do not need to create them beforehand.