☀️ ☔ ❄️ 🍃 My 1st application 'Weather forecast' CHAP.5: Creating mock database for the application.

22 Apr 2023  ・ 3 min read

Table of Contents


As we know, databases are essential for every application, and the greater the variety of databases we have, the more options we have for applications. To generate a mock database for a weather forecasting application, I used .

Create - Table

Firstly, I created a called with five fields: , , , and . I configured the as with a maximum is 1000 .

  • : the table we are working on.
  • : to add more field in the table.
  • : The number of data we want to generate, with a maximum of 1000 rows and a minimum of 1 row.
  • : to start generating new data.
  • : where we can see the table before officially creating it.
  • : where we set up the format of the file/table, it can be or or any other formats.

After clicking on , the system automatically downloaded the schema/table.

Upload to

I clicked on

and chose the file.

Now in , I have in format as the reference table for .

And now, I have two tables/schemas, one is and the other is .

About in and table

I wanted to create weather forecast for today and the next 7 days for each location. Therefore, I generated 7000 records of weather forecasts for 1000 location records.

To link the two table, I configured the type of the field to in the schema. Next, I chose (the previous name of table) as the , and at , I chose as well. I chose the of the schema as .

One issue I encountered with is that if I wanna set up as the of , I have to configure the of as . If it's not , there will be no table displayed at and .

Ref 1: Problem with dataset

Ref 2: Problem with dataset

Adding Database to Application

When I tried to use the to add the database to the application, I encountered this bug.

Initially, I was perplexed by the issue at hand, which appeared to be a involving the character . Subsequently, I utilized the command to identify the number of records containing the problematic character, and was dismayed to find that the number exceeded one thousand. Given the inefficiency of manually fixing or deleting the offending character in each instance, I set out to find a tool capable of automating the task.

Upon encountering the error message, which read "character with byte sequence 0x81 in encoding 'WIN1252' has no equivalent in encoding 'UTF8'", I resorted to conducting a search on Google. My quest led me to an exceptional tool, which boasts an unassuming layout but offers unparalleled functionality.

Find the incredible tool here!

The tool's interface features several key components, including:

  • : which allows for the upload of the file in question that requires conversion.
  • : which enables the user to choose the desired encoding for the converted file.
  • : which type of encoding I want my file to be converted to.
  • : which specifies the name and format of the exported file.

I referred to another webpage when I successfully installed and configured the environment variables to run using the .

check out the following webpage for detailed instructions on how to install PostgreSQL on Windows

In terms of application security, I came across a useful webpage when attempting to import a database. The webpage provided me with valuable insights on how to use the psql command to import and export databases.

Import a PostgreSQL Database with psql Command

Let's now take a look at how the database performs in the application's layout.

  • (1): Search by country: , clicking on the country card to get the weather forecast.
  • (2): Go back to the main page by clicking on left /.
  • (3): Search by city: , clicking on the city card to get the weather forecast.

Many thank you for reading, and in my next chapter,I may continue sharing my experience with backend development using Docker😊.