Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Full Stack Web Development with Raspberry Pi 3

You're reading from   Full Stack Web Development with Raspberry Pi 3 Build complex web applications with a portable computer

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher Packt
ISBN-13 9781788295895
Length 214 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Soham Kamani Soham Kamani
Author Profile Icon Soham Kamani
Soham Kamani
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started on the Raspberry Pi FREE CHAPTER 2. Getting Up-and-Running with Web Development on the Raspberry Pi 3. Running a Node Server on the Pi 4. Extracting Information from the GPIO Pins 5. Retrieving Sensor Readings from the Server 6. Creating a Web Page to Display Sensor Data 7. Enhancing Our UI - Using Interactive Charts 8. SQLite - The Fast and Portable Database 9. Integrating SQLite into Our Application 10. Making our Application Real Time with Web Sockets 11. Deploying our application to Firebase 12. Using Firebase APIs to Update Our Application

Creating the temperature and humidity tables

For our application, we will be creating two tables, one each for our temperature and humidity readings. The structure will be similar for both of them:

  • The createdAt column to store the date and time of creation
  • The value column to store the actual value read by the sensor

When creating the table, it's useful to know SQLites datatypes. This will not be a hard task since there are only five:

  • TEXT
  • NUMERIC
  • INTEGER
  • REAL
  • BLOB
In most other relational databases, there is a data type for datetime, which we would have used for our createdAt column. In the case of SQLite, the datetime is represented either as a string in the ISO format (YYYY-MM-DD HH:MM:SS), or as an integer in Unix time (the time elapsed since 1970-01-01 00:00:00 UTC).

From this, we decide the types of these:

  • createdAt as TEXT (ISO formatted datetime)
  • value as REAL...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image