F-strings
F-strings are a readable approach to building new strings from existing strings. Currently PRQL supports this for concatenating strings:
PRQL
from employees
select full_name = f"{first_name} {last_name}"
SQL
SELECT
CONCAT(first_name, ' ', last_name) AS full_name
FROM
employees
This can be much easier to read for longer strings, relative to the SQL approach:
PRQL
from web
select url = f"http{tls}://www.{domain}.{tld}/{page}"
SQL
SELECT
CONCAT(
'http',
tls,
'://www.',
domain,
'.',
tld,
'/',
page
) AS url
FROM
web
Note that interpolations can only contain plain variable names and not whole expression like Python.
Roadmap
In the future, f-strings may incorporate string formatting such as datetimes, numbers, and padding. If there’s a feature that would be helpful, please post an issue.