Create Tables in the Data Store

Next, let’s create a table in the Data Store of the NewsApp project. We will be creating seven tables to store news of various news categories. Let’s begin by creating the first table.

To create a table:

  1. Navigate to the Cloud Scale service from the Catalyst console, and click Start Exploring. cron_catalyst_cloud_scale

  2. Navigate to Data Store under STORAGE. Click Create a new Table. cron_create_table

  3. Enter the table’s name as ‘HEADLINES’ and click Create. cron_table_name

This table will store the general headlines of the news items obtained through NewsAPI.

Note: Ensure that you enter the name exactly as instructed, because the application's code contains the same name.

The table is now created and displayed in the Data Store page.

Now click New Table in the Data Store page each time to create the other tables in the same way. cron_new_table_name

Create 6 other tables and name them as follows: ‘BUSINESS’, ‘ENTERTAINMENT’, ‘HEALTH’, ‘SCIENCE’, ‘SPORTS’, ‘TECHNOLOGY’.

Note: Ensure that you enter all the table names exactly as instructed, because the application's code contains the same name.

The tables will be displayed on the left in the Data Store page. cron_six_tables

Create Columns

Now, let’s create columns in all the tables. We will create two columns in each table:

  • title: To store the title of the news article
  • url: To store the original URL of the news article’s source

To create a column in a table:

  1. Click New Column in the Schema View section for the table. cron_add_column

  2. Enter the column’s name as ‘title’. Select the data type as Var Char and enter the max length as ‘255’. cron_column_config
    You can learn about the various data types supported by Catalyst and the other properties of a column from the Data Store help page.

Note: Ensure that you enter the name exactly as instructed, because the application's code contains the same name.
  1. Click Create.

Now create the ‘url’ column in the same way. Provide the same values. cron_column_url_config

The columns are now created for the table and will be listed in the Schema View section. cron_all_tables


Now create the same columns with the same values in each of the other six tables.

We have now configured the Data Store. We will work on coding the application from our local system. We will configure the Cron component at the end.

Last Updated 2023-12-14 16:25:23 +0530 +0530

RELATED LINKS

Data Store