Skip to main content

FunBase: encrypted file-based database with .fb extension

Project description

FunBase

  • RU: FunBase — это любительский проект, разработанный Nite017, представляющий удобную базу данных с расширением FB
  • EN: FunBase is a hobby project developed by Nite017, providing a user-friendly database with the FB extension

В последней версии 1.1 | In last Update:

FunBase Editor

Превью приложения

Возможности | Features

  • create_table(table_name) — создать таблицу / create a table.
  • insert(table_name, record) — добавить запись / insert a record.
  • select_all(table_name) — получить все записи / get all records.
  • Update(table_name, 'SET x = (?) WHERE y = (?)', value, where_value, count) — обновление по строковому шаблону / update with SQL-like syntax.
  • Update_int(table_name, 'SET x = (?) WHERE y > (?)', value, where_value, count) — числовое обновление / numeric update.
  • remove(table_name, '(?) WHERE y = (?)', value, where_value, count) — удаление по шаблону / remove by template.
  • search(table_name, phrase) — поиск по фразе / search by phrase.
  • select_random(table_name, column, count) — случайные значения колонки / random values from a column.
  • print_random(table_name, count) — случайные записи / random records.
  • delete_table(table_name) — удалить таблицу / delete a table.
  • tables() — список таблиц / list tables.

Правила Update | Update rules

db.Update("users", "SET name = (?) WHERE id = (?)", "Alice", 1, 0)

RU: Последний аргумент — количество обновлений. 0 значит обновить все подходящие записи. EN: The last argument is the number of updates. 0 means update all matching records.

Правила remove | Remove rules

db.remove("users", "(?) WHERE age = (?)", 25, 2)

RU: Последний аргумент — количество удалений. 0 значит удалить все подходящие записи. EN: The last argument is the number of deletions. 0 means remove all matching records.

Правила Update_int | Update_int rules

Поддерживаются / Supported:

  • =
  • ==
  • !=
  • >
  • <
  • >=
  • <=
db.Update_int("users", "SET age = (?) WHERE age > (?)", 40, 25, 1)

Пример | Example

from funbase import FunBase
import os

DB_FILE = "demo_v5.fb"

if os.path.exists(DB_FILE):
    os.remove(DB_FILE)

db = FunBase(DB_FILE)

db.create_table("users")
db.insert("users", {"id": 1, "name": "Alice", "age": 25})
db.insert("users", {"id": 2, "name": "Bob", "age": 30})
db.insert("users", {"id": 3, "name": "Charlie", "age": 18})
db.insert("users", {"id": 4, "name": "Diana", "age": 30})

print("Before:")
for row in db.select_all("users"):
    print(row)

print("\nUpdate:")
db.Update("users", "SET name = (?) WHERE id = (?)", "Bobby", 2, 1)

print("\nRemove:")
db.remove("users", "WHERE age = (?)", 30, 1)

print("\nSearch 'Ali':")
print(db.search("users", "Ali"))

print("\nRandom ids:")
print(db.select_random("users", "id", 2))

print("\nRandom rows:")
db.print_random("users", 2)

print("\nAfter:")
for row in db.select_all("users"):
    print(row)

Пример | Example

from funbase import FunBase

db = FunBase("demo_v5.fb")

print("RU: Таблицы | EN: Tables:", db.tables())

print("\nRU: Поиск по фразе 'Bob' | EN: Search phrase 'Bob':")
print(db.search("users", "Bob"))

print("\nRU: Случайные id | EN: Random ids:")
print(db.select_random("users", "id", 2))

print("\nRU: Случайные записи | EN: Random rows:")
db.print_random("users", 2)

print("\nRU: Все данные | EN: All data:")
for table in db.tables():
    print(f"\n=== {table} ===")
    for row in db.select_all(table):
        print(row)

Ошибки | Errors

RU: Сообщения об ошибках выводятся на русском и английском. EN: Error messages are shown in both Russian and English.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

funbase-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file funbase-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: funbase-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.7

File hashes

Hashes for funbase-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf6f4e22c73dff13c9add926f16bb7f13d3831a92cf9946b19c2157e746c24fb
MD5 d8a30c60ee646b730baf38960496ae1b
BLAKE2b-256 ed4b85eeb9dcfb83a6453ba99c7b4d092f890ddb38c983359ba59d0c11de49c6

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