PowerSQL

PowerSQL, the data transformation tool.

Features:

Getting started

Install the latest version using cargo (curl https://sh.rustup.rs -sSf | sh).

cargo install powersql

PostgreSQL

To get started with PostgreSQL, simply create a new project in a file called powersql.toml:

[project] name = "my_project" models = ["models"] tests = ["tests]

Now create one or more models in the models directory:

sql CREATE VIEW my_model AS SELECT id, category from my_source; CREATE TABLE category_stats AS SELECT COUNT(*) category_count FROM my_model GROUP BY category;

PowerSQL automatically will create a DAG based on the relations in your database.

To run against the database, provide the following environment variables:

Commands

Data tests

Data tests are SQL queries that you can run on your database tables and views and perform checks on data quality, recency, etc. The test fails if the query returns 1 or more rows.

Some examples: ```sql -- NULL check SELECT 1 FROM t WHERE column IS NULL; -- Check values SELECT 1 FROM t WHERE amount < 0; -- Check relations SELECT 1 FROM t LEFT JOIN u ON t.id = u.id WHERE u.id IS NULL; -- Prefix check SELECT 1 FROM t WHERE NOT STARTSWITH(strcolumn, "http");

```