Skip to content

Commit

Permalink
chore: Backport #4473 to web (#4476)
Browse files Browse the repository at this point in the history
Co-authored-by: Rich Brown <[email protected]>
  • Loading branch information
prql-bot and richb-hanover authored May 15, 2024
1 parent 3f4dd1a commit 466ec66
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions web/book/src/reference/spec/modules.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Modules

> This is a technical document. For a "how to use" or a TLDR; skip to the
> [Example](#example) section.
```admonish warning
The `module` facility is in discussion.
This page documents our understanding of the way
the final PRQL compiler will likely work.
The PRQL compiler currently uses these techniques to compile
the `std`, `date`, `text`, and `math` modules into the language.
Design goals:
However, at this time (Spring 2024), the `module` facility does not work
within a PRQL query itself.
That is, a `module` statement in a query cannot import files
from the local file system.
```

Design goals for **modules**:

1. Allow importing declarations from other files.

Expand Down Expand Up @@ -113,8 +123,13 @@ let album_titles = my_playlists

## File importing

> This section is under discussion. Current implementation plans do not include
> `module` declarations, but loading of all files under the compilation path.
```admonish warning
The examples below do **not** work.
At this time (Spring 2024), the `module` facility does not work
within a PRQL query itself.
That is, a `module` statement in a query cannot import files
from the local file system.
```

To include PRQL source code from other files, we can use the following syntax:

Expand Down Expand Up @@ -241,7 +256,7 @@ connector (i.e. JDBC) where no other files can be loaded.

## Built-in module structure

> Work In Progress
> As noted above, this facility is in discussion.
```
# root module of every project
Expand All @@ -264,6 +279,14 @@ module project {

## Example

```admonish warning
The examples below do **not** work.
At this time (Spring 2024), the `module` facility does not work
within a PRQL query itself.
That is, a `module` statement in a query cannot import files
from the local file system.
```

This is an example project, where each of code block is a separate file.

```
Expand Down

0 comments on commit 466ec66

Please sign in to comment.