Re:Show HN: PRQL 0.2 – a better SQL
by ithrow on Monday June 27, 2022 @02:31PM
(#31898679)
To avoid working with SQL strings.
[ Parent
| on HN ]
SQL/jinja like dbt could also avoid working with SQL strings. what would be the better advantage?
There is already an integration for dbt: https://github.com/prql/dbt-prql
For example
{% prql %}
from source = {{ source('salesforce', 'in_process') }}
derive expected_sales = probability * value
join {{ ref('team', 'team_sales') }} [name]
group name (
aggregate (sum expected_sales)
)
{% endprql %}
would appear to dbt as SELECT
name,
SUM(source.probability * source.value) AS expected_sales
FROM
{{ source('salesforce', 'in_process') }} AS source
JOIN {{ ref('team', 'team_sales') }} USING(name)
GROUP BY
name
dbt is definitely a use case we are very aware of and I am personally very keen on (since I use that in my $dayjob). With some of the ideas in https://github.com/prql/prql/issues/381 , I think PRQL could really shine in this area!With your contribution we can get there faster!