Skip to content

Writing Drone Telemetry to a SQLite Database

Dave Walker edited this page Jan 24, 2020 · 6 revisions

Namespace

The package, library and namespace for in-memory database capture is:

TelloCommander.Data.Sqlite

Prerequisites

Creating the SQLite Database

Prior to capturing data to a SQLite database, you must ensure:

  • The database file has been created
  • The Entity Framework Core migrations have been run to set up the database tables required by the capture

The easiest way to do this is to use a console application to run the migrations:

  • Create a console application that references the TelloCommander and TelloCommanderDb libraries
  • Add an appsettings.json file with the following content:
{
  "ConnectionStrings": {
    "TelloCommanderDb": "Data Source=<path>/tellocommander.db"
  }
}
  • Where is the path to the folder where you wish the database to be written
  • Set the build action on the "appsettings.json" file to Content
  • Set the "copy to output" property on the "appsettings.json" file to "Always"
  • Add the following using statements to the Program.cs file of the application:
using TelloCommander.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
  • Add the following to the Main() method:
TelloCommanderDbContext context = new TelloCommanderDbContextFactory().CreateDbContext(null);
context.Database.Migrate();
  • Compile and run the application to create the SQLite database at the specified

Configuring Your Application Settings File

THIS SECTION UNDER CONSTRUCTION

Capturing Telemetry

Please see the information in the Telemetry to SQL Overview page.

Querying the Data

Please see the information in the Telemetry to SQL Overview page.