25.4. Joining Postgres Pro and External Data #
You can join Postgres Pro tables with external data sources in a single query.
Example 25.4.
-- Join a local Postgres Pro 'customers' table with a remote Parquet file of 'orders'
SELECT
c.customer_name,
c.signup_date,
SUM(r['order_total']) AS total_spent
FROM
customers c -- This is a Postgres Pro table
JOIN
read_parquet('s3://my-bucket/orders/*.parquet') r ON c.customer_id = r['customer_id']
WHERE
c.status = 'active'
GROUP BY
c.customer_name,
c.signup_date
ORDER BY
total_spent DESC;