Loading text files to QuickSight

The easiest way to load data to QuickSight is to just upload it to SPICE, which was explained in Chapter 1, A Quick Start to QuickSight. Another alternative to uploading text files is to use S3 storage and this section will detail this flow.

Uploading a data file to S3

For this demonstration, we will use the file USAStateAbbr.csv, which has a list of USA state codes and the corresponding full names.

Here are the detailed steps to upload a file to an S3 filesystem:

  1. Download the file to your local system (laptop).
  2. Upload the file to AWS S3, login to our account, and from the Services menu select S3.
  3. Select the S3 bucket or create a new S3 bucket. In the next screenshot, I have selected the collegescorecard bucket that I created earlier.
  4. Click on the Upload button, select the local file from your system, and then upload.

    Uploading a data file to S3

    Figure 2.7: Upload text file to S3

  5. Now that the file is uploaded to S3; review its properties, which will be needed in later steps, as shown in the following screenshot:

    Uploading a data file to S3

    Figure 2.8: S3 file properties

Building the manifest file

To upload files to SPICE, we first need to create a manifest file, which is a JSON file with the following structure:

{ 
  "fileLocations": [
    {"URIs": ["uri1", "uri2", "uri3"]}, 
    {"URIPrefixes": ["prefix1", "prefix2", "prefix3"]} 
  ], 
  "globalUploadSettings": {
    "format": "CSV",
    "delimiter": ",",
    "textqualifier": "'",
    "containsHeader": "true"
  } 
} 

The manifest file elements are described as follows:

  • fileLocations: This is used to specify the files to be uploaded. You can specify a list of file URIs in an array or specify URIPrefixes where all files in the specific folder will be imported. QuickSight does not recursively retrieve files from child folders.
  • globalUploadSettings (optional): This is used to specify format, delimiter, textqualifier, and containsHeader.

The following is the manifest example to load the USAStateAbbr file:

{ 
  "fileLocations": [ 
    { 
      "URIs": [ 
        "https://s3.amazonaws.com/collegescorecard/USAStateAbbr.csv" 
      ] 
    } 
  ], 
  "globalUploadSettings": { 
    "format": "CSV", 
    "delimiter": ",", 
    "containsHeader": "true" 
  } 
} 

Creating a new QuickSight dataset from S3

Next, we will see how this file can be imported to QuickSight using the following steps:

  1. From the QuickSight home page, click on Manage data.
  2. Next, select New data set and then select S3. Next, upload the manifest file created in the previous steps and click on Connect, as shown in the following screenshot:

    Creating a new QuickSight dataset from S3

    Figure 2.9: New S3 dataset

This completes the import of S3 data as a dataset in QuickSight that can be further visualized for analysis.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset