Skip to main content

DataBase with GitHub Repo

Project description

Description

An easy-to-use cloud database that uses a GitHub repository to store data. # Example Using an example, I will show you how to create a database for a Discord server using pycord

import discord
from discord.ext import commands,tasks
import json
from db_kirosake import dbkirosake
from settings.config import *

DB=dbkirosake.DBKirosake(
    actoken, # access token your GitHub account
    repos # your private/public repository
)

intents = discord.Intents.all()

client = commands.Bot(
    command_prefix=prefix,
    intents=intents,
    bot=True
)
client.remove_command('help')

@client.event
async def on_ready():
    for guild in client.guilds:
        for member in guild.members:
            db={
                'lvl':1,
                'cash':10
            }
            await DB.create_db(
                nameDB='test',
                folder=guild.id,
                ids=member.id,
                database=db
            )

client.run(token)

A database is created with the name nameDB which contains a folder called guild.id and file users.json

Structure ../test/1234567890/users.json The users.json file contains the list:

{
    "here ids": {
        "lvl": 1,
        "cash": 10
    }
}

Data update

DB=DBKirosake(
    actoken,
    repos
)
await DB.insert_one(
     nameDB='test',
     folder="1234567890",
     ids="0987654321",
     insert='lvl',
     value=5,
     method='r' #r or a; replace or add
 )

Get dictionary

dict=await DB.get(
     nameDB='test',
     folder="1234567890",
     ids="0987654321"
 )
 print(dict)

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

db-kirosake-1.6.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

db_kirosake-1.6-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file db-kirosake-1.6.tar.gz.

File metadata

  • Download URL: db-kirosake-1.6.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.8.2 requests/2.27.1 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.4

File hashes

Hashes for db-kirosake-1.6.tar.gz
Algorithm Hash digest
SHA256 0fdaf7aad21c526b7909105c3d26b4365f957fae06b1f5f540c63958a5c76530
MD5 ec29cc8df1523b864314f9d4e9239daf
BLAKE2b-256 935060a7a83c5780188a3769cb19b1eb9d5046dda24829a274ac5fc8c27cf2b2

See more details on using hashes here.

File details

Details for the file db_kirosake-1.6-py3-none-any.whl.

File metadata

  • Download URL: db_kirosake-1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.8.2 requests/2.27.1 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.10.4

File hashes

Hashes for db_kirosake-1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3d78f20570641689386b621eb307d4c5425964f35e00fea88ab7f63c3f2d69b3
MD5 655bd895d1a2df19c8da9295ccac94b2
BLAKE2b-256 0a0a1545a62eaa142b87a2c7a45a43fd5432310aeef661533b21ff2deba96f8f

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