jshrake / healthkit-to-sqlite

Command-line tool to convert Apple HealthKit data to a SQLite database.
Apache License 2.0
8 stars 1 forks source link

table Workout has no column named workoutStatistics #3

Open oubiwann opened 11 months ago

oubiwann commented 11 months ago

Describe the bug

After several minutes of running this:

healthkit-to-sqlite export.zip sqlite://healthkit.db

I get the reported error.

To Reproduce If possible, please share a minimal export.zip or XML snippet that can reproduce the issue.

Debug Output Please share the relevant log output after running with RUST_LOG=debug. This will provide insight into any SQL failures:

RUST_LOG=debug healthkit-to-sqlite export.zip sqlite://healthkit.db
[2023-08-12T04:25:38Z INFO  sqlx::query] INSERT INTO Workout (`workoutActivityType`, …; rows affected: 0, rows returned: 0, elapsed: 29.500µs

    INSERT INTO
      Workout (
        `workoutActivityType`,
        `duration`,
        `durationUnit`,
        `totalDistance`,
        `totalDistanceUnit`,
        `totalEnergyBurned`,
        `totalEnergyBurnedUnit`,
        `sourceName`,
        `sourceVersion`,
        `device`,
        `creationDate`,
        `startDate`,
        `endDate`,
        `metadata_HKIndoorWorkout`,
        `metadata_HKTimeZone`,
        `metadata_HKWeatherTemperature`,
        `metadata_HKWeatherHumidity`,
        `workoutEvents`,
        `workoutStatistics`,
        `geometry`
      )
    VALUES
      (
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?,
        ?
      )

Error: error returned from database: (code: 1) table Workout has no column named workoutStatistics

Caused by:
    (code: 1) table Workout has no column named workoutStatistics

Desktop (please complete the following information):

Additional context

$ sqlite3 healthkit.db
SQLite version 3.36.0 2021-06-18 18:58:49
Enter ".help" for usage hints.
sqlite> .schema Workout
CREATE TABLE `workout`
  (
     `creationdate`                         DATE,
     `device`                               TEXT,
     `duration`                             REAL,
     `durationunit`                         TEXT,
     `enddate`                              DATE,
     `geometry`                             JSON,
     `metadata_hkaveragemets`               TEXT,
     `metadata_hkelevationascended`         TEXT,
     `metadata_hkindoorworkout`             INTEGER,
     `metadata_hkmetadatakeysyncidentifier` TEXT,
     `metadata_hkmetadatakeysyncversion`    INTEGER,
     `metadata_hktimezone`                  TEXT,
     `metadata_hkweatherhumidity`           TEXT,
     `metadata_hkweathertemperature`        TEXT,
     `sourcename`                           TEXT,
     `sourceversion`                        TEXT,
     `startdate`                            DATE,
     `totaldistance`                        REAL,
     `totaldistanceunit`                    TEXT,
     `totalenergyburned`                    REAL,
     `totalenergyburnedunit`                TEXT,
     `workoutactivitytype`                  TEXT,
     `workoutevents`                        JSON
  ); 
oubiwann commented 11 months ago

Here's some more info on the db that was setup:

sqlite> .schema ActivitySummary
CREATE TABLE `activitysummary`
  (
     `activeenergyburned`     INTEGER,
     `activeenergyburnedgoal` INTEGER,
     `activeenergyburnedunit` TEXT,
     `appleexercisetime`      INTEGER,
     `appleexercisetimegoal`  INTEGER,
     `applemovetime`          INTEGER,
     `applemovetimegoal`      INTEGER,
     `applestandhours`        INTEGER,
     `applestandhoursgoal`    INTEGER,
     `datecomponents`         DATE
  ); 
sqlite> .tables
ActivitySummary
HKCategoryTypeIdentifierAppleStandHour
HKCategoryTypeIdentifierAudioExposureEvent
HKCategoryTypeIdentifierMindfulSession
HKCategoryTypeIdentifierSleepAnalysis
HKQuantityTypeIdentifierActiveEnergyBurned
HKQuantityTypeIdentifierAppleExerciseTime
HKQuantityTypeIdentifierAppleStandTime
HKQuantityTypeIdentifierAppleWalkingSteadiness
HKQuantityTypeIdentifierBasalEnergyBurned
HKQuantityTypeIdentifierBodyMass
HKQuantityTypeIdentifierDistanceCycling
HKQuantityTypeIdentifierDistanceWalkingRunning
HKQuantityTypeIdentifierEnvironmentalAudioExposure
HKQuantityTypeIdentifierFlightsClimbed
HKQuantityTypeIdentifierHeadphoneAudioExposure
HKQuantityTypeIdentifierHeartRate
HKQuantityTypeIdentifierHeartRateVariabilitySDNN
HKQuantityTypeIdentifierHeight
HKQuantityTypeIdentifierRestingHeartRate
HKQuantityTypeIdentifierSixMinuteWalkTestDistance
HKQuantityTypeIdentifierStepCount
HKQuantityTypeIdentifierWalkingAsymmetryPercentage
HKQuantityTypeIdentifierWalkingDoubleSupportPercentage
HKQuantityTypeIdentifierWalkingHeartRateAverage
HKQuantityTypeIdentifierWalkingSpeed
HKQuantityTypeIdentifierWalkingStepLength
Workout
_sqlx_migrations