Explore the data
Exploring the data in SQLite
Open the database in either DB Browser for SQLite or SQLite viewer plugin for Visual Studio Code
- DBBrowser for SQLite
- VSCode - SQLite Browser
Launch DB Browser for SQLite
Open the database.db file in the project directory.
Click on the Browse Data tab and select the devicemodel table.
Double click the database.db file within VSCode.
Expand the devicemodel to view the data.
Each device is represented as a row in the devicemodel table.
The site_id column of each row references the ID of a row in the sitemodel table. This models a one to many relationship otherwise known as a ForeignKey relationship.
Exploring the data in the graph database (Neo4j)
Navigate to the Neo4j Browser.
Connect to the database using the username "neo4j" and password "admin".
When you are connected, click on the database icon in the top left.
Click on the Device Node Label.
There should be 5 device nodes displayed.
Click one of the device nodes to see the properties of the node.
We can see that attributes of an instance of a devicemodel are stored as the properties of the node.
Click on the device node again and select the relationships icon.
The node has a relationship to site-1 with a label of LOCATED_IN that represents the type of the relationship. This relationship mimics a Foreign Key relationship.
Currently, tags are a standalone model and do not have relationships with any other models. It may prove useful to allow multiple tags to be added to multiple devices.
The next steps will implement a Many-to-Many relationship between tags and devices within both types of databases.
Time to get our hands on some code!