Skip to main content
FiQueLa provides several ways to open a file and obtain a query object. All approaches ultimately produce the same chainable query interface.
Use Stream\Provider::fromFile() to open a file. The format is detected from the file extension automatically, or you can pass an explicit Format enum.

FileQuery syntax

The FileQuery string is a compact notation used in fromFileQuery() and inside FQL FROM, JOIN, and INTO clauses.
Examples:

Quoted file paths

An unquoted path may contain only letters, digits, whitespace, and _ . - /. Put the path in double or single quotes when it contains anything else — parentheses, brackets, commas, \ in Windows paths, or diacritics:
Quoted paths work everywhere a FileQuery is accepted: FROM, JOIN, INTO, DESCRIBE, Query\Provider::fromFileQuery(), and new FileQuery().
  • The path is taken verbatim between the quotes. There are no escape sequences, so \ is a plain character.
  • Use single quotes when the path contains ", and double quotes when it contains '. A path that contains both cannot be written in a FileQuery.
  • Backticks are not path quotes.
  • Positional and named parameters and the data path after the closing parenthesis work as before. Unquoted paths keep working unchanged.
When FiQueLa writes a FileQuery back — (string) $query, EXPLAIN, FileQuery::__toString(), toFql() — it quotes the path only when needed. FileQuery::pathToFql() returns a path in that form:
Quoted file paths are available since FiQueLa 3.4.0. Earlier versions threw FileQueryException (“Invalid query path”) for paths with these characters.

Default parameter values

Default values are omitted from the serialized output. For example, csv(data.csv) is equivalent to csv(data.csv, "utf-8", ",").
CSV bom is opt-in (0 or 1). When set to 1, the writer emits a UTF-8 BOM. The reader auto-detects and skips UTF-8, UTF-16 LE/BE, and UTF-32 LE/BE BOMs regardless of the bom parameter, and transcodes non-UTF-8 input via a stream filter.

Querying from a string

You can also open an in-memory string rather than a file using Stream\Provider::fromString().
All opening methods return the same Interface\Query object, so you can chain the same fluent methods regardless of how you opened the file.