Forum Discussion

sathishmadavali's avatar
sathishmadavali
New Contributor II
3 years ago

How to load Today Date Files from s3 Bucket to SLDB

Hi,
I am getting the files from amazon s3 bucket every day, I want to load today date files from s3 bucket to SLDB.Any one can help me on that. Thanking you in advance.

Thanks
M SATHISH

17 Replies

  • Hi @sathishmadavali,

    One way to filter only today’s files is to browse the S3 Bucket using the S3 Browser and after that to use a Filter Snap with the following expression:

    Date.parse($lastModified) >= Date.parse(Date.now().toLocaleDateString())
    

    If your file pool in S3 is growing at increasing rate you might consider another approach.

    Let me know if this helps you.

    BR,
    Aleksandar.

    • sathishmadavali's avatar
      sathishmadavali
      New Contributor II

      Hi,
      @AleksandarAngelevski , the output of the filter snap is in csv format, by using which snap we can read the csv data .after getting the today file.

      thanking you
      m sathish

      • Aleksandar_A's avatar
        Aleksandar_A
        Contributor III

        Hi @sathishmadavali,

        If you are using the S3 Browser Snap then the output is as in the picture below:

        You will have to use the File Reader Snap with the appropriate S3 Account and you will need to pass the Path value from the Filter Upstream.

        File Reader Snap:

        Let me know if this helps.

        BR,
        Aleksandar.

  • darshthakkar's avatar
    darshthakkar
    Valued Contributor

    For your reference, Date.now().minusDays(1).toLocaleDateString()
    Try to incorporate this in your pipeline and test it out.

    Regards,
    Darsh

  • darshthakkar's avatar
    darshthakkar
    Valued Contributor

    @sathishmadavali : You can use 2 snaps over here:

    1. Multi-File Reader and provide the path ensuring that the wildcard only takes into consideration the format you’re looking for (e.g. csv). You will have to specify multiple paths if you’re wanting to read multiple files.

    2. Using router → if you go into views, you can add additional views for which you can write different functions like $objectKey == “testing.csv”, second function would be $objectKey == “testing.json” so on and so forth. This works if you’re having $objectKey in your upstream.

    Moreover, I would also urge to open a new topic as we have branched out from reading today’s file to separating files. Thankyou.

    CC: @dmiller @AleksandarAngelevski

  • darshthakkar's avatar
    darshthakkar
    Valued Contributor

    You had to tweak a little bit, are you having $lastModified in your upsteam?