copy-to.pt 972 B

12345678910111213141516171819202122232425262728293031323334
  1. # Note that this file will not work on PG due to the not standard COPY TO s3 command
  2. send
  3. Query {"query": "CREATE SECRET aws_secret_access_key AS 'minioadmin'"}
  4. ----
  5. until
  6. ReadyForQuery
  7. ----
  8. CommandComplete {"tag":"CREATE SECRET"}
  9. ReadyForQuery {"status":"I"}
  10. # Create aws connection to be used
  11. send
  12. Query {"query": "CREATE CONNECTION aws_conn TO AWS (ACCESS KEY ID = 'minioadmin', SECRET ACCESS KEY = SECRET aws_secret_access_key, REGION = 'us-east-1', ENDPOINT = 'http://localhost:40109')"}
  13. ----
  14. until
  15. ReadyForQuery
  16. ----
  17. CommandComplete {"tag":"CREATE CONNECTION"}
  18. ReadyForQuery {"status":"I"}
  19. # Ensure COPY TO works and returns COPY tag.
  20. # Using a SELECT query with zero rows so that it does not try to write to s3.
  21. send
  22. Query {"query": "COPY (SELECT generate_series(1, 0)) TO 's3://copytos3/1' WITH (AWS CONNECTION = aws_conn, FORMAT = 'csv', MAX FILE SIZE = '100MB')"}
  23. ----
  24. until
  25. ReadyForQuery
  26. ----
  27. CommandComplete {"tag":"COPY 0"}
  28. ReadyForQuery {"status":"I"}