Skip to content

Instantly share code, notes, and snippets.

@hgross
Created August 16, 2021 11:56
Show Gist options
  • Save hgross/4965215db7cc9eb9c648b1c3bae506bd to your computer and use it in GitHub Desktop.
Save hgross/4965215db7cc9eb9c648b1c3bae506bd to your computer and use it in GitHub Desktop.
This is a minimal sql query to extract the most important information of the FilamentManager OctoPrint plugin's sqlite datbase file to a SpoolManager importable CSV file..

OctoPrint: FilamentManager to SpoolManager conversion

This is a minimal sql query to extract the most important information of the FilamentManager OctoPrint Plugin's sqlite datbase file to a SpoolManager importable CSV file.

Steps:

  1. The FilamentManager database file can be extracted from an OctoPrint backup (zip-)file. The path in the backup file shoud be basedir/data/filamentmanager/filament.db.
  2. Use a tool like (DB Browser for SQLite)[https://sqlitebrowser.org/dl/] (or similar) to open the FilamentManager database file
  3. Execute convert_filamentmanager_db_to_spoolmanager.sql and export the result as CSV.
  4. Use the SpoolManager import function with the exported CSV (From OctoPrint settings).
SELECT
profiles.vendor AS "Vendor",
spools.name AS "Spool Name",
spools.cost AS Cost,
"€" as "Cost unit",
spools.weight AS "Total weight [g]",
(spools.weight - spools.used) AS "Spool weight [g]",
spools.used AS "Used weight [g]",
(profiles.density * 100) AS "Density [g/cm3]",
"imported from FilamentManager" AS Note
from spools LEFT JOIN profiles WHERE spools.profile_id == profiles.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment