Git Product home page Git Product logo

amazedb's Introduction

amazedb

Version License

It is a file based NoSQL database management system written in python.

All the databases are stored in the db sub-directory of the current directory. This behaviour can be manipulated as we'll see later on.

How to use

You can install amazedb through pip.

$ python -m pip install amazedb

Example usage

from amazedb import dbms

# Open a database
mydb = dbms.db("mydatabase")

# Create a group inside it
users = mydb.createGroup("users")

# Or access it via
users = mydb.getGroup("users")

# Add some data to our users
users.insert({
    "name": "Jalaj",
    "role": "admin",
    "email": "[email protected]",
    "age": 17
})

# Or add multiple documents simultaneously
users.insert_many(
    {"name": "ABCD", "age": 10},
    {"name": "EFGH", "age": 20},
    {"name": "IJKL", "age": 30}
)

# Get the user with the name ABCD
abcd = user.get_one({"name": "ABCD"})

# Or use some advanced search filters
abcd = users.get_one({
    "name": {"__re" : ".*A.*"} # All users with A in their name,
    "age": {"__gt": 10} # All users with age more than 10
})

# Or get them sorted
# Get all users sorted by age
abcd = users.get({}, sortby="age")

# Update some values
updated = users.update({
    "name" : "ABCD"         # Find the user with the name ABCD
}, {
    "email" : "[email protected]" # And update its email field
})

# Use advanced search in update function
updated = users.update({
    # All users with age greater than or equal to 10
    "age": {"__gte" : 10}
}, {
    "age": 5
})

# Update the firs occurence of search filter
update_one = users.update_one({

    # You can also use custom functions for search
    "name": { "__cf": lambda val: True if len(val) > 10 else False}
}, {
    "name": "newName"
})

# Delete some documents
delete = users.remove({
    "name": "ABCD"
})

# Delete only one document
del_one = users.remove_one({
    "name": "EFGH"
})

# Delete the group
users.drop()

# Delete the database
mydb.drop()

For detailed usage instructions, refer to USAGE.md

Contributing

Contributions to our project through new issues and pull requests are always welcome. We would love to see other people contribute to the project and make it better.

Although, before you contribute, you should follow our issue templates. Any PR or issue not following one of the templates will be ignored and closed immediately. And yes, before opening a issue and don't forget to follow the code of conduct

License

This project is licensed under MIT.

amazedb's People

Contributors

jalaj711 avatar

Stargazers

 avatar

Watchers

 avatar

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.