What is MIME type "application/x-prql"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

application/x-prql marks plain text files that include source code written in the PRQL language.
PRQL is a pipeline-oriented query language. It converts human-friendly queries into SQL or similar database instructions.
Files using this MIME type are marked with the PRQL extension.
For more details, visit the official PRQL website.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: application/x-prql    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="application/x-prql">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'application/x-prql');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the primary use of application/x-prql?

This MIME type is used to identify source code files written in PRQL (Pipelined Relational Query Language). It tells web servers and text editors that the content is a structured query language designed to be transpiled into SQL.

How do I configure Apache to serve .prql files correctly?

To associate the extension with the correct MIME type in Apache, add the following line to your .htaccess file or main configuration: AddType application/x-prql .prql. This ensures the server sends the correct Content-Type header to clients.

Why does the MIME type start with 'application/x-'?

The x- prefix indicates that application/x-prql is a non-standard or experimental subtype not yet formally registered with the IANA. While it is the accepted convention for PRQL files, it falls under the private use category.

Can web browsers execute application/x-prql files?

No, web browsers cannot execute PRQL natively. If you navigate to a file with this MIME type, the browser will usually treat it as a generic binary file and trigger a download, or display it as plain text if configured to do so.

How does this differ from application/sql?

While both relate to databases, application/x-prql contains the source logic in the PRQL pipeline syntax, whereas application/sql contains standard SQL statements. PRQL code is typically compiled into SQL before being sent to a database.

What software opens files with this MIME type?

Since PRQL files are plain text, they can be opened with any text editor like Notepad, Vim, or Sublime Text. However, developers typically use IDEs like VS Code with specific extensions that recognize application/x-prql to provide syntax highlighting.

Are there security risks associated with serving PRQL files?

As with any source code, serving application/x-prql files publicly may expose your database schema or business logic. Ensure your server is configured to block access to these files if they are intended only for backend processing.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.