This example creates the foreign table sensordata with the PATHPATTERN option set to:
$Var1/$Var2/$var3/$Var4/$date
Although the LOCATION clause only contains two levels (data and logs) below the bucket, the path pattern specifies several other levels. The LOCATION string only identifies a key prefix and there can be many levels below that in the actual data set being examined. Also, the logs entry in the LOCATION string can also include a longer name, such as, logsdaily.
CREATE MULTISET FOREIGN TABLE sensordata (
Location VARCHAR(2048) CHARACTER SET UNICODE CASESPECIFIC,
Payload JSON(8388096) INLINE LENGTH 32000 CHARACTER SET UNICODE)
USING (
LOCATION ('/S3/YOUR-BUCKET.s3.amazonaws.com/data/logs')
PATHPATTERN ('$Var1/$Var2/$var3/$Var4/$date')
)
NO PRIMARY INDEX;