25.4. Соединение данных Postgres Pro с внешними данными #

В одном запросе можно соединять таблицы Postgres Pro с внешними источниками данных.

Пример 25.4.

-- Соединить локальную таблицу Postgres Pro 'customers' с удалённым Parquet-файлом '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;