Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 25, 2024
1 parent be669ef commit f8792da
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/book/src/project/integrations/postgresql.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL

PL/PRQL is a PostgreSQL extension that lets you write functions with PRQL.
PL/PRQL is a PostgreSQL extension that lets you write functions with PRQL.

PL/PRQL functions serve as intermediaries, compiling the user's PRQL code into SQL statements that PostgreSQL executes. The extension is based on the [pgrx](https://github.com/pgcentralfoundation/pgrx) for developing PostgreSQL extensions in Rust. This framework manages the interaction with PostgreSQL's internal APIs, type conversions, and other function hooks necessary to integrate PRQL with PostgreSQL.

Expand All @@ -23,22 +23,22 @@ create function match_stats(int) returns table(player text, kd_ratio float) as $
$$ language plprql;

select * from match_stats(1001)
player | kd_ratio

player | kd_ratio
---------+----------
Player1 | 0.625
Player2 | 1.6
(2 rows)
```

You can also run PRQL directly with the `prql` function which is useful for custom SQL in ORMs:

```sql
select prql('from matches | filter player == ''Player1''', 'player1_cursor');

fetch 2 from player1_cursor;

id | match_id | round | player | kills | deaths
id | match_id | round | player | kills | deaths
----+----------+-------+---------+-------+--------
1 | 1001 | 1 | Player1 | 4 | 1
3 | 1001 | 2 | Player1 | 1 | 7
Expand Down

0 comments on commit f8792da

Please sign in to comment.