Initializing the Database File

You can either create a database from a Python application or write a file with SQL instructions and initialize the database from the command line. Alternatively, SQLite3 provides a command-line tool to interact with the database.

Listing 9-1 shows the complete sequence of initialization SQL statements; this will make further reading easier, as the server code is going to contain lots of SQL statements and you really need to have the table schema and initial data at hand.

Listing 9-1. Initialisation SQL commands for the server database -- Table: SENSOR

-- Description: List of all available sensors

DROP TABLE IF EXISTS sensor;

CREATE TABLE sensor (

id INTEGER PRIMARY KEY, name TEXT

Was this article helpful?

0 0

Post a comment