The filesystem data source adapter allows you to map a directory, inclusive of all its subdirectories, as a relational table. This feature enables querying the content of a specific filesystem path.
The table resulting from the mapping process contains various file attributes, as detailed in the table below:
Column | Description |
---|---|
path | The absolute path of a file or directory. |
name | The name of the file or directory. |
size | The size of the file in bytes. This is null for a directory. |
file | The file represented as a file object. |
You can distinguish between a file and a directory by performing a null check on the “size” column.
The QFS data source can operate in two MultimediaFlavors:
- DEFAULT: The QFS source returns bytes instead of file references. If a row corresponds to a directory reference, the “file” column value is set to null.
- FILE: The QFS source returns a file reference (pointing to a file or directory). The subsequent actions depend on the query interface. For instance, the Polypheny-UI allows file downloads (directories are automatically zipped).
The root path of the data source can be specified upon deployment and modified subsequently. To enhance security, the QFS data source operates with a whitelist comprising all permitted paths. The root directory must either be included in the whitelist or be a sub-directory of an entry in the whitelist. The whitelist can be found in the config folder: ~/.polypheny/config/whitelist.config
Deployment
To deploy the QFS adapter, navigate to the Polypheny-UI (Adapters -> Sources) and specify the root path for the data source. Remember to ensure that your root directory complies with the whitelist restrictions as mentioned above.
Once the adapter is successfully deployed, you can query the content of the specified path as a relational table. This functionality enables convenient access and query execution on filesystem data.