How to include a sqlite database in a snap

Hey guys, I am writing an app that looks up information in a sqlite database and forwards it via datalayer to the PLC application running on the core. However I am unsure on how to include the database in the snap. I've tried using the layout feature in the snap.yaml to create a symlink to the database but I am not sure if this is the correctr approach 

I am also currently dynamically setting the path in the main program but when I print the path to the log I don't see the snap_data directory being used any thoughts are appreciated.

 

Best reply by Sgilk

Hello mvial ,

When you say include the database, do you mean copy an existing database into the application, or connect to an external database?

There are many ways to do this, but I would think you could simply copy the database using the dump plugin. See this example from the SDK.

  configs:
    plugin: dump
    source: ./configs
    organize:
      'package-assets/*': package-assets/${SNAPCRAFT_PROJECT_NAME}/

This plugin copies the files from the build /configs directory and places the package-assets file within the app folder package-assets/${SNAPCRAFT_PROJECT_NAME}/

View original
4 replies