Giter Site home page Giter Site logo

repltable's Introduction

image

PyPI - Downloads code style

this is a project is to make it so that you can have tables in the replit db.

the main annoyance (for me) with replit is that it reverts a lot of database file changes, which forces you to use the repl.it database. also, you can't group together keys, and it takes FOREVER to install, due to it installing flask, aiohttp and a ton of other things you don't need for the database.

⚙️ installation

pip install repltable

🪴 usage

# if you are using this on replit
from repltable import db

# or...
from repltable import Database
db = Database("https://kv.replit.com/v0/...")


# repltable databases work like a dictionary
db.get(foo='bar')
>>> [{'foo': 'bar'}]

# repltable auto-creates tables if they don't exist
db.insert(dict(foo='bar'))

# you can get one, or get all matching documents
db.get_one(foo='bar')
>>> {'foo': 'bar'}


# you can also group keys together
from repltable import TableDatabase

table = TableDatabase.get("users")
# from here, it behaves as a regular database

table.get(foo='bar')
>>> [{'foo': 'bar'}]

# repltable auto-creates tables if they don't exist
table.insert(dict(foo='bar'))

# you can get one, or get all matching documents
table.get_one(foo='bar')
>>> {'foo': 'bar'}

❓ why not just use replit-py?

well, my goal is to make it so that you can use repl.it databases without having to use replit-py. replit-py has 27 dependencies. repltable has 2.

plus, repltable has more features:

  • caching (auto-updates itself for accuracy!)
  • groups of keys (named tables)
  • uses more efficient queries (you can filter keys!)

👥 contributing

to contribute, fork the repo, make a branch, and send a pull request.

for local development, you can install the dependencies with poetry:

poetry install

📜 license

this project is licensed under the mit license.

repltable's People

Contributors

thrzl avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

wynwxst

repltable's Issues

faster replit db wrapper

I truly hope that I don't have to create this myself but if I really do I will:

Can anybody recommend any replit db wrappers that are faster than the basic one? It doesn't necessarily have to be complete, it just needs basic set/get. If you can recommend any, that would be quite useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.