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 dbkirosake import DBKirosake
from settings.config import *
DB=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
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
db-kirosake-0.7.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for db_kirosake-0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e597e62592f196ed17e43e340096d5971f5b06549af6d736f3961281d83e96f4 |
|
MD5 | 638698a50435543be59b69a42bdcbcbd |
|
BLAKE2b-256 | 98d4a2f67546da81b9b667a056cc986480a698d2095f19e3889eb6d381a07878 |