Skip to main content

Store settings in a sql database

Project description

sqlsettingslib

Python lib: Store settings in a database

What is this library for?

In some projects you might want to store some variables for longer than you run the program. When restarting the program you might still want some settings to be the same. Those settings could be stored in a database. This lib does all the complicated part for you.

Usage

from sqlsettingslib import Setting

# Define the path for your database
path = "path/to/sqlsettingslib.sqlite3"

# Create a sqlsettingslib object:
s = Setting(path)

# Add some sqlsettingslib
s.add_setting(
    text_id="user_name",
    readable_name="User name",
    description="A name for the user",
    value="MyCoolUserName"
)

print(s["user_name"])
# -> "MyCoolUserName"

s["user_name"] = "AnotherCoolName"
print(s["user_name"])
# -> "AnotherCoolName"

s.update_setting(
    text_id="user_name",
    description="A unique name for the user."
)

print(s.get_setting(detail="description")[0])
# -> "A unique name for the user."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sqlsettingslib, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size sqlsettingslib-0.0.4-py3-none-any.whl (16.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sqlsettingslib-0.0.4.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page