Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Sqlite3 on ctrlX CORE for app data

Sqlite3 on ctrlX CORE for app data

asti
Member

Hello,

is there a way to install a lightweight database (eg. sqlite3) on ctrlX CORE to store configuration data of a snap. 

I know that the ctrlX solutions snap is provided to save configurations to have backup data. But I want to access data in a more efficiently way and update snap data very often. 

Thank you : )

7 REPLIES 7

CodeShepherd
Community Moderator
Community Moderator

The easiest way would be to use our data broker the ctrlX Data Layer for creating accessible data. See the SDK provider examples.

DataLayer broker might be easy to access, but I want to store persistent data (configuration data).

What would you suggest? Do you have experience with lightweight databases on ctrlX CORE?

 

 

CodeShepherd
Community Moderator
Community Moderator

On the ctrlX Data Layer it is also possible to create persistent variables. The storage type would be sharedretain. You can simply adapt the realtime example of our SDK.

See also the documentation of the Data Layer:

aFouraker
Occasional Contributor

I have written something here based on the work hereI have introduced some bug in the latest version that I have not had time to fix. However, a version that works (at least for my testing) is available on snapcraft. You can download for the core using "UBUNTU_STORE_ARCH=arm64 snap download sqlite-ctrlx"

The read me should give you a good explanation. 

Thanks for your help! I´ll try your app. : )

How did you install your sqlite db? I downloaded sqlite3 as a snap file, but couldn´t install it successfully.

aFouraker
Occasional Contributor

On an Ubuntu machine you need to run "UBUNTU_STORE_ARCH=arm64 snap download sqlite-ctrlx" from the terminal. This will download the file for the hardware and "UBUNTU_STORE_ARCH=amd64 snap download sqlite-ctrlx" for the virutal core. Install them in the normal way after the download. You can ignore the assertion file that is downloaded. Make sure you have the option to run developer apps set on your core. 

bostroemc
Occasional Contributor

Just a comment on the snap that aFouraker references here:  In this use case it is not required to install SQLite separately.  The associated snap runs as a standalone, referencing SQLite internally.

When creating an app like this the only requirement is to import the sqlite3 module in your Python code.

 import_sqlite.png

 
Further, since this module is included in the standard Python library (unlike here jsonschema), it is not required to make reference to it in your snapcraft.yaml file:
 
sqlite_yaml.png
 
 
 
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist