You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. # AWS S3 Select feature in Seaweedfs
  2. ## Start weed
  3. ```bash
  4. git checkout s3-select
  5. # Compile weed
  6. weed server -s3
  7. ```
  8. ## Install And Configure AWSCLI
  9. ```bash
  10. pip install awscli
  11. aws configure // default all the way
  12. aws configure set default.s3.signature_version s3v4
  13. ```
  14. ## Make a bucket in S3
  15. ```bash
  16. aws --endpoint-url http://localhost:8333 s3 mb s3://newbucketgoogle
  17. ```
  18. ## Download googleplaystore.csv
  19. Link: https://www.kaggle.com/lava18/google-play-store-apps
  20. ## Copy the file to the S3 bucket
  21. ```bash
  22. aws --endpoint-url http://localhost:8333 s3 copy google-play-store-apps/googleplaystore.csv s3://newbucketgoogle
  23. ```
  24. ## Perform S3 Select Query
  25. ```bash
  26. aws --endpoint-url http://localhost:8333 s3api select-object-content --bucket "newbucketgoogle" --key
  27. "googleplaystore.csv" --expression "select * from s3object limit 5" --expression-type 'SQL' --input-serialization '{"CSV": {"FileHeaderInfo": "USE","RecordDelimiter": "\n","FieldDelimiter": ","}, "CompressionType": "NONE"}' --output-serialization '{"CSV": {"RecordDelimiter": "\n","FieldDelimiter": ","}}' "sample.csv"
  28. ```
  29. ## Check out result
  30. ```bash
  31. vim sample.csv
  32. ```