Skip to main content

PieData is a database based on separate files.

Project description

PieData is an ORM-wrapped file database that supports SQL-like commands via a WebSocket server. Each table is stored as a folder, each record as an XML file. The ORM layer allows you to work with Python models, and the server handles client commands via WebSocket.


It's not working properly in linux system


Installation

Install via pip:

pip install piedata

Quickstart

Define models (models.py)

from PieData import IntegerField, StringField, DatetimeField, FloatField, PieModel

class User(PieModel):
    name = StringField(max_length=255)
    age = IntegerField(min_value=0, max_value=100)

Synchronous usage (main.py)

from PieData import PieData
from models import User

db = PieData()

db.create_table(User)

user = User(name="Alice", age=30)
db.insert(user)

users = db.select(User, as_model=True)

# Update and delete
updated = db.update(User, {"age": 31}, "name = 'Alice'")
deleted = db.delete(User, "age = 31")

Asynchronous usage (async_main.py)

import asyncio
from PieData import PieData
from models import User

async def main():
    async with PieData() as db:
        await db.create_table_async(User)
        await db.insert_async(User(name="Bob", age=25))
        users = await db.select_async(User, as_model=True)

if __name__ == '__main__':
    asyncio.run(main())

Command-Line Interface (piedata)

After installing you can manage the PieData server with the piedata command. The PID file is written to:

  • Windows: %APPDATA%\PieDataServer\piedataserver.pid
  • Linux/macOS: ~/.PieDataServer/piedataserver.pid

Available subcommands:

piedata start         # Start the PieData WebSocket server in the background
piedata stop          # Stop the server by PID
piedata restart       # Restart the server (stop + start)
piedata autostart     # Enable OS autostart for the server
piedata noautostart   # Disable OS autostart for the server
  • start: Launches the server in the background.

  • stop: Reads the PID from the file and terminates the process.

  • restart: Performs stop followed by start.

  • autostart / noautostart:

    • On Windows, modifies the registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Run.
    • On Linux/macOS, creates or removes the desktop file ~/.config/autostart/piedataserver.desktop.

Example:

# Start the server and enable autostart
piedata start
piedata autostart

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

piedata-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

piedata-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file piedata-0.1.0.tar.gz.

File metadata

  • Download URL: piedata-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for piedata-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a895bdb2648178ef56e811658671659affae747d910d4c8b9089123c553531cf
MD5 a1d1560461221b207cd54160bc69737f
BLAKE2b-256 67f411b2061e857978530f4a6c22625e2e6b4102a7359c954c052def930972ea

See more details on using hashes here.

File details

Details for the file piedata-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: piedata-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for piedata-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47b99895c0fec0df9c97da17a87c6954aa30f4ebdad33d38836cc7a4ac15dc21
MD5 ef6368705ca194446411c7af1b6e31d0
BLAKE2b-256 eae3dfec7fea9f2f444005aae0b6dc383ce6b1b8a246a74f421f7524a7a72ce8

See more details on using hashes here.

Supported by

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