|
1 | 1 | # FileXdb-Python |
2 | 2 | FileXdb is a lightweight local NoSQL database, optimized for best coding experience. |
3 | 3 |
|
4 | | -It's written in Core Python and has no external dependencies. The target is to reduce the complexity of installing & data handling of any external SQL-Database. |
| 4 | +It's written in Core Python and has no external dependencies. The target is to reduce the complexity of installing external SQL Database & data handling. |
5 | 5 |
|
6 | | -#### FileXdb is: |
7 | | -* A local, File-based, lightweight, horizontally scaled NoSQL Database. |
8 | | -* Designed to be simple and interesting to use by providing simple and clean APIs. |
9 | | -* A Collection & Document oriented approach. |
10 | | -* Works on all modern versions of Python and PyPy. |
| 6 | +> #### FileXdb is: |
| 7 | +> - A local, File-based, lightweight, horizontally scaled NoSQL Database. |
| 8 | +> - Designed to be simple and interesting to use by providing simple and clean APIs. |
| 9 | +> - A `Collection` & `Document` oriented approach. |
| 10 | +> - Works on all modern versions of Python and PyPy. |
11 | 11 |
|
12 | 12 |
|
13 | 13 | # Supported Python Versions |
14 | | -**FileXdb** has been tested with Python 3.7 – 3.11 and PyPy3. Just install and enjoy. |
15 | | - |
| 14 | +Since newer versions of Python are often faster, have more features and are better supported, the latest version of Python 3 is recommended for **FileXdb**. You may use it on older versions as well. |
16 | 15 |
|
17 | 16 | # Installation |
18 | | -## setup |
| 17 | +Install FileXdb using _**[pip](https://pip.pypa.io/en/stable/getting-started/)**_ : |
| 18 | + |
| 19 | +#### Windows: |
| 20 | + python -m pip install filexdb |
| 21 | + |
| 22 | +#### Linux / MAC: |
| 23 | + python3 -m pip install filexdb |
| 24 | + |
| 25 | +# Getting Start |
| 26 | +```python |
| 27 | +from filexdb import FileXdb |
| 28 | + |
| 29 | +db = FileXdb("db-name", "path/to/data/dir") |
| 30 | +new_coll = db.collection("collection-name") |
| 31 | + |
| 32 | +new_coll.insert({"name": "Sam", "skills": ["Python", "C++"]}) |
| 33 | +``` |
| 34 | + |
| 35 | + |
| 36 | +### Insert Multiple Documents |
| 37 | +```python |
| 38 | +data = [ |
| 39 | + { |
| 40 | + "name": "Jack", |
| 41 | + "dept": "CSE" |
| 42 | + }, |
| 43 | + { |
| 44 | + "name": "Rocky", |
| 45 | + "address": { |
| 46 | + "PO": "Bongaon", |
| 47 | + "PS": "Kolkata" |
| 48 | + }, |
| 49 | + "skills": [ |
| 50 | + "Game Dev" |
| 51 | + ] |
| 52 | + }, |
| 53 | + { |
| 54 | + "name": "Rahul" |
| 55 | + } |
| 56 | +] |
| 57 | + |
| 58 | +new_coll.insert_all(data) # `data` should be a List of JSON Object |
| 59 | +``` |
| 60 | + |
| 61 | + |
| 62 | +### Find Documents |
| 63 | + |
| 64 | +```python |
| 65 | +query = {"name": "Sam"} |
| 66 | + |
| 67 | +# Returns all Documents. |
| 68 | +new_coll.find() |
| 69 | + |
| 70 | +# Returns all Documents matches the ``_query``. |
| 71 | +new_coll.find(query=query) |
| 72 | + |
| 73 | +# Returns doc[1] to doc[2] matches the ``_query``. |
| 74 | +new_coll.find(query=query, limit=(1, 3)) |
| 75 | + |
| 76 | +# Returns doc[1] to doc[9] of all Documents. |
| 77 | +new_coll.find(limit=(3, 50)) |
| 78 | +``` |
| 79 | + |
| 80 | + |
| 81 | +### Update Documents |
| 82 | +```python |
| 83 | +query = { |
| 84 | + "name": "Rocky" |
| 85 | +} |
| 86 | + |
| 87 | +updated_data = { |
| 88 | + "name": "Rocky Bhai", |
| 89 | + "skills": [ |
| 90 | + "Game Dev", |
| 91 | + "C++", |
| 92 | + "Python" |
| 93 | + ] |
| 94 | +} |
| 95 | + |
| 96 | +new_coll.update(updated_data, query) |
| 97 | +``` |
19 | 98 |
|
20 | 99 |
|
| 100 | +### Delete Documents |
| 101 | +```python |
| 102 | +query = { |
| 103 | + "name": "Rocky Bhai", |
| 104 | + "dept": "ECE" |
| 105 | +} |
21 | 106 |
|
| 107 | +new_coll.delete(query) |
| 108 | +``` |
22 | 109 |
|
| 110 | +# More Features |
| 111 | +_FileXdb_ is in `Beta` stage. Currently we have above features only. We will come back to you with other advanced features soon. |
23 | 112 |
|
| 113 | +You may also contribute in this journey. |
24 | 114 |
|
25 | 115 |
|
26 | 116 |
|
| 117 | +# Contributing |
27 | 118 |
|
| 119 | +Thank you for investing your time in [contributing](https://github.com/FileXdb/FileXdb-Python/blob/master/CONTRIBUTING.md) to our project! Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community. Any contribution you make will be reflected on `github.com/FileXdb/FileXdb-Python`✨. |
28 | 120 |
|
| 121 | +Contributions to _FileXdb_ are welcome! Here's how to get started: |
29 | 122 |
|
| 123 | +- Open an [issue](https://github.com/FileXdb/FileXdb-Python/issues) or find for related issues to start a discussion around a feature idea or a bug. |
| 124 | +- Fork the [repository](https://github.com/FileXdb/FileXdb-Python) on GitHub. |
| 125 | +- Create a new branch of the master branch and start making your changes. |
| 126 | +- Make a meaning-full commit. |
| 127 | +- Write a test, which shows that the bug is fixed or the feature works as expected. |
| 128 | +- Send a pull request and wait until it gets merged and published. |
0 commit comments