Open-source Reactive Python database
Project description
Skypy - open-source reactive database.
The better way to build Python logging system!
pip install skypydb # python client
# or download from the source
# git clone https://github.com/Ahen-Studio/skypy-db.git
# cd skypy-db
# pip install -r requirements.txt
Features
-
Simple: fully-documented
-
Table: create, delete, search data from tables
-
Security, Input Validation: AES-256-GCM encryption for data at rest with selective field encryption, automatic protection against SQL injection attacks
-
CLI: command line interface to initialize your database
-
Observable: Dashboard with real-time data, metrics, and query inspection
-
Free & Open Source: MIT Licensed
TODO
- code the database backend
- improve user data security
- code a custom cli
- Create the dashboard using Reflex
- write the documentation
What's next!
- give us ideas!
Cli
- use the cli to initialize your database with one simple command
skypydb init
- run this command in your terminal it will create a .env.local file containing an encryption key and a salt key to encrypt your data
- use the cli to access the dashboard
skypydb dev --allow-dashboard
- run this command in your terminal with the required --allow-dashboard flag to start the dashboard with only the project data
Secure Implementation
- first create a encryption key and make it available in .env file don't show this key to anyone
from skypydb.security import EncryptionManager
# Generate a secure encryption key
encryption_key = EncryptionManager.generate_key()
salt = EncryptionManager.generate_salt()
print(encryption_key) # don't show this key to anyone
print(salt) # don't show this salt to anyone
- Use the encryption key to encrypt sensitive data
import os
import skypydb
from skypydb.errors import TableAlreadyExistsError
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
# Load encryption key from environment
encryption_key = os.getenv("ENCRYPTION_KEY") # create a encryption key and make it available in .env file before using it, don't show this key to anyone
salt_key = os.getenv("SALT_KEY") # create a salt key and make it available in .env file before using it, don't show this salt to anyone
# transform salt key to bytes
if salt_key is None:
raise ValueError("SALT_KEY missing")
salt_bytes = salt_key.encode("utf-8")
# Create encrypted database
client = skypydb.Client(
path="./data/secure.db",
encryption_key=encryption_key,
salt=salt_bytes,
encrypted_fields=["password", "ssn", "credit_card"] # Optional: encrypt only sensitive fields
)
# All operations work the same - encryption is transparent!
try:
table = client.create_table("users")# Create the table.
except TableAlreadyExistsError:
# Tables already exist, that's fine
pass
table = client.get_table("users")
# Automatically encrypted
table.add(
username=["alice"],
email=["alice@example.com"],
ssn=["123-45-6789"] # only this field is if encrypted_fields is not None encrypted
)
# Data is automatically decrypted when retrieved
results = table.search(
index="alice"# search the corresponding data by their index
)
for result in results:
print(result)
API
- use the api with a custom config
import skypydb
from skypydb.errors import TableAlreadyExistsError
# setup skypydb client.
client = skypydb.Client(path="./data/skypy.db", auto_start_dashboard=False)
# config to make custom table.
config = {
"all-my-documents": {
"title": "str",
"user_id": str,
"content": str,
"id": "auto"
},
"all-my-documents1": {
"title": "str",
"user_id": str,
"content": str,
"id": "auto"
},
"all-my-documents2": {
"title": "str",
"user_id": str,
"content": str,
"id": "auto"
},
}
# Create tables. get_table_from_config(config, table_name="all-my-documents"), delete_table_from_config(config, table_name="all-my-documents") are also available.
try:
table = client.create_table_from_config(config)# Create all the tables present in the config.
except TableAlreadyExistsError:
# Tables already exist, that's fine
pass
# Retrieve the table before adding any data.
table = client.get_table_from_config(config, table_name="all-my-documents")
# Add data to a table.
table.add(
title=["document"],
user_id=["user123"],
content=["this is a document"],
id=["auto"]# ids are automatically created by the backend.
)
# Start the Dashboard (blocking mode keeps it running)
client.start_dashboard(block=True)
- use the api without a custom config
import skypydb
from skypydb.errors import TableAlreadyExistsError
# setup skypydb client.
client = skypydb.Client(path="./data/skypy.db", auto_start_dashboard=False)
# Create table. get_table, delete_table are also available.
try:
table = client.create_table("all-my-documents")
except TableAlreadyExistsError:
# Tables already exist, that's fine
pass
# Retrieve the table before adding any data.
table = client.get_table("all-my-documents")
# Add data to the table.
table.add(
title=["document"],
user_id=["user123"],
content=["this is a document"],
id=["auto"]# ids are automatically created by the backend
)
# Start the Dashboard (blocking mode keeps it running)
client.start_dashboard(block=True)
Dashboard
Start the dashboard to view your data in real time. It will remain active after your operations:
import skypydb
# Dashboard will auto-start in non-blocking mode by default
client = skypydb.Client(path="./data/skypy.db")
# Or explicitly disable auto-start and start it later with blocking mode
client = skypydb.Client(path="./data/skypy.db", auto_start_dashboard=False)
# ... your operations here ...
# Start the Dashboard (blocking mode keeps it running)
client.start_dashboard(block=True) # Dashboard accessible at http://127.0.0.1:3000
Dashboard options:
# Change the dashboard port
client = skypydb.Client(
path="./data/skypy.db",
dashboard_port=8080,# Change the port of the dashboard
auto_start_dashboard=False
)
# ... your operations here ...
# Start the Dashboard in blocking mode (keeps the program running)
client.start_dashboard(block=True)
# Or use non-blocking mode to continue with other operations
client.start_dashboard(block=False)
# Disable auto-start
client = skypydb.Client(
path="./data/skypy.db",
auto_start_dashboard=False
)
# Start manually later
client.start_dashboard(block=False)
# Kill the dashboard later
client.stop_dashboard()
Learn more on our Docs
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skypydb-0.1.4.tar.gz.
File metadata
- Download URL: skypydb-0.1.4.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
907735e2743d1017b05bfe48d11e779d557401a3672b968cfa335343d660e7be
|
|
| MD5 |
51aff976d4a24a1ddec121b97dc3474d
|
|
| BLAKE2b-256 |
940535ec02a767b2382b5b6218aa988930bd7f7a8098ae58cff73055b35ab18f
|
Provenance
The following attestation bundles were made for skypydb-0.1.4.tar.gz:
Publisher:
python-publish.yml on Ahen-Studio/skypy-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skypydb-0.1.4.tar.gz -
Subject digest:
907735e2743d1017b05bfe48d11e779d557401a3672b968cfa335343d660e7be - Sigstore transparency entry: 846452812
- Sigstore integration time:
-
Permalink:
Ahen-Studio/skypy-db@4e58e7c9df2c44c46df162f54c95bddbe460a9f4 -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/Ahen-Studio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4e58e7c9df2c44c46df162f54c95bddbe460a9f4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file skypydb-0.1.4-py3-none-any.whl.
File metadata
- Download URL: skypydb-0.1.4-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d2406f9e8cdf24316676f409cb40e49389c34b8338a7915e35c6bb8736310b9
|
|
| MD5 |
82a860839eaaef987e46edd08a02e3e8
|
|
| BLAKE2b-256 |
f83807d52d7f0b659e860935e5280fccddea7fdba6be95764df39dd40cfaca2d
|
Provenance
The following attestation bundles were made for skypydb-0.1.4-py3-none-any.whl:
Publisher:
python-publish.yml on Ahen-Studio/skypy-db
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skypydb-0.1.4-py3-none-any.whl -
Subject digest:
5d2406f9e8cdf24316676f409cb40e49389c34b8338a7915e35c6bb8736310b9 - Sigstore transparency entry: 846452837
- Sigstore integration time:
-
Permalink:
Ahen-Studio/skypy-db@4e58e7c9df2c44c46df162f54c95bddbe460a9f4 -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/Ahen-Studio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4e58e7c9df2c44c46df162f54c95bddbe460a9f4 -
Trigger Event:
release
-
Statement type: