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.

Source Distribution

sqlsettingslib-0.0.9.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file sqlsettingslib-0.0.9.tar.gz.

File metadata

  • Download URL: sqlsettingslib-0.0.9.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for sqlsettingslib-0.0.9.tar.gz
Algorithm Hash digest
SHA256 447f806712ac9c8d73bdbd0c5327a96d5324db4f734b6c1a7cb40bb351b82df3
MD5 a8df52d306513059674dfcb7c4360d4a
BLAKE2b-256 769344c9f4f42d9eeee17b06e3b35642a6c8deb1e42f32ced35ab91b756c7541

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page