willowDb


NamewillowDb JSON
Version 0.1.10 PyPI version JSON
download
home_pagehttps://github.com/monkeytravel/willowDb
SummaryA document database as a python module
upload_time2024-03-30 21:50:16
maintainerNone
docs_urlNone
authorCameron Perrier
requires_pythonNone
licenseMIT
keywords db documentdb nosql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WillowDb
## Simple json document nosql database with indexes

WillowDb is a simple json document nosql database all in a python module

# Features

- Secondary indexes for use with faster querys
- Built for speed with Query,insert,update and delete commands
- Scan command will be the most recourse intensive
- Scan command with filter statement that has the same format as python if statement
- Update Command to update a record
- Delete Command to update a record

# Installation

WillowDb requires [Python](https://python.org/) 3+ to run.

```sh
pip install willowDb
```

# Usage

#### Setup 
```sh
import willowDb
db = willowDb.Setup(folderPath="path/to/your/db/folder" errorConfig='raise')
```
##### Setup Options:
- folderPath(optional): if provided it will look for an create tables in the folder provided otherwise it will create the tables
 inside the WillowDb module folder.
- errorConfig(optional)
    -  raise:  On errors will raise an error
    -  log: On errors will log an error
    -  both: On errors will log and raise an error
    -  None: On errors will do nothing

#### List Table
```sh
willowDb.listTables()
```

#### Create Table
```sh
willowDb.createTable(name="demoTable", primaryKey="id")
```
##### Create Table Options:
- name(REQUIRED): Name of the the table to create
- primaryKey(REQUIRED): Primary key for the default index of the table (the field to used to query, update, delete)

#### Table Initialization
```sh
demoTable = willowDb.table(name="demoTable", createPrimaryKey=True)
```

#### List Indexes
```sh
demoTable.listIndexes()
```


##### Table Initialization Options:
- name(REQUIRED): Name of the the table to use
- createPrimaryKey(Optional): Boolean, if True and the primary key is not in the insert data then it will create uuid for the
primary key.  For example bec6b12a-7302-462a-b526-bef9a07bc2a4.  If False it will not create a primary key.

#### Insert
```sh
demoTable.insert(data = {"id": "1234", "demoData1": "demo1", "demoData2": "demo2"})
```

##### Insert Options:
- data(REQUIRED): Dictionary, data to be inserted into table.  If createPrimaryKey was True on Table Initialization then the data 
must include the primary key.

#### Query
```sh
results = demoTable.query(primaryKey="1234", indexName="indexName")
```

##### Query Options:
- primaryKey(REQUIRED): The primary key of the record to fetch.
- indexName(Optional): If using an index, provide index here.  Defaults to the "default" index. 

#### Update
```sh
demoTable.update(primaryKey="1234", record={"demoData2": "demo2Updated"})
```

##### Update Options:
- primaryKey(REQUIRED): The primary key of the record to update.
- record(REQUIRED): Dictionary, the data to update in the record, if key already exists in the record the value will be updated.
If the key does not exist in the record the key and value will be added.  If the primary key is in the record it will be ignored.

#### Delete
```sh
demoTable.delete(primaryKey="1234")
```

##### Delete Options:
- primaryKey(REQUIRED): The primary key of the record to delete.

#### Scan
```sh
results = demoTable.scan(filter="demoData1 == 'demo1'")
```

##### Scan Options:
- filter(Optional): String, a python if statement in a string format to filter the data by, if not provided will grab the entire table

#### Create Index
```sh
demoTable.createIndex(indexName='demoData1Index', primaryKey='demoData1')
```

##### Create Index Options:
- indexName(REQUIRED): Name of the the index to create
- primaryKey(REQUIRED): Primary key for the index (the field to used to query)

#### Delete Index
```sh
devicesTable.deleteIndex(indexName="typeIndex")
```

##### Delete Index Options:
- indexName(REQUIRED): Name of the the index to delete

#### Delete Table
```sh
willowDb.deleteTable(name=tableName)
```

##### Delete Table Options:
- tableName(REQUIRED): Name of the the table to delete.
## License

MIT License

Copyright (c) 2024 monkeytravel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/monkeytravel/willowDb",
    "name": "willowDb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "db, documentDb, nosql",
    "author": "Cameron Perrier",
    "author_email": "dev@thegalacticgroup.com",
    "download_url": "https://files.pythonhosted.org/packages/64/65/2dbd2495fda69b515a8147044f680c51becde5af21076dde82a84d224bba/willowDb-0.1.10.tar.gz",
    "platform": null,
    "description": "# WillowDb\n## Simple json document nosql database with indexes\n\nWillowDb is a simple json document nosql database all in a python module\n\n# Features\n\n- Secondary indexes for use with faster querys\n- Built for speed with Query,insert,update and delete commands\n- Scan command will be the most recourse intensive\n- Scan command with filter statement that has the same format as python if statement\n- Update Command to update a record\n- Delete Command to update a record\n\n# Installation\n\nWillowDb requires [Python](https://python.org/) 3+ to run.\n\n```sh\npip install willowDb\n```\n\n# Usage\n\n#### Setup \n```sh\nimport willowDb\ndb = willowDb.Setup(folderPath=\"path/to/your/db/folder\" errorConfig='raise')\n```\n##### Setup Options:\n- folderPath(optional): if provided it will look for an create tables in the folder provided otherwise it will create the tables\n inside the WillowDb module folder.\n- errorConfig(optional)\n    -  raise:  On errors will raise an error\n    -  log: On errors will log an error\n    -  both: On errors will log and raise an error\n    -  None: On errors will do nothing\n\n#### List Table\n```sh\nwillowDb.listTables()\n```\n\n#### Create Table\n```sh\nwillowDb.createTable(name=\"demoTable\", primaryKey=\"id\")\n```\n##### Create Table Options:\n- name(REQUIRED): Name of the the table to create\n- primaryKey(REQUIRED): Primary key for the default index of the table (the field to used to query, update, delete)\n\n#### Table Initialization\n```sh\ndemoTable = willowDb.table(name=\"demoTable\", createPrimaryKey=True)\n```\n\n#### List Indexes\n```sh\ndemoTable.listIndexes()\n```\n\n\n##### Table Initialization Options:\n- name(REQUIRED): Name of the the table to use\n- createPrimaryKey(Optional): Boolean, if True and the primary key is not in the insert data then it will create uuid for the\nprimary key.  For example bec6b12a-7302-462a-b526-bef9a07bc2a4.  If False it will not create a primary key.\n\n#### Insert\n```sh\ndemoTable.insert(data = {\"id\": \"1234\", \"demoData1\": \"demo1\", \"demoData2\": \"demo2\"})\n```\n\n##### Insert Options:\n- data(REQUIRED): Dictionary, data to be inserted into table.  If createPrimaryKey was True on Table Initialization then the data \nmust include the primary key.\n\n#### Query\n```sh\nresults = demoTable.query(primaryKey=\"1234\", indexName=\"indexName\")\n```\n\n##### Query Options:\n- primaryKey(REQUIRED): The primary key of the record to fetch.\n- indexName(Optional): If using an index, provide index here.  Defaults to the \"default\" index. \n\n#### Update\n```sh\ndemoTable.update(primaryKey=\"1234\", record={\"demoData2\": \"demo2Updated\"})\n```\n\n##### Update Options:\n- primaryKey(REQUIRED): The primary key of the record to update.\n- record(REQUIRED): Dictionary, the data to update in the record, if key already exists in the record the value will be updated.\nIf the key does not exist in the record the key and value will be added.  If the primary key is in the record it will be ignored.\n\n#### Delete\n```sh\ndemoTable.delete(primaryKey=\"1234\")\n```\n\n##### Delete Options:\n- primaryKey(REQUIRED): The primary key of the record to delete.\n\n#### Scan\n```sh\nresults = demoTable.scan(filter=\"demoData1 == 'demo1'\")\n```\n\n##### Scan Options:\n- filter(Optional): String, a python if statement in a string format to filter the data by, if not provided will grab the entire table\n\n#### Create Index\n```sh\ndemoTable.createIndex(indexName='demoData1Index', primaryKey='demoData1')\n```\n\n##### Create Index Options:\n- indexName(REQUIRED): Name of the the index to create\n- primaryKey(REQUIRED): Primary key for the index (the field to used to query)\n\n#### Delete Index\n```sh\ndevicesTable.deleteIndex(indexName=\"typeIndex\")\n```\n\n##### Delete Index Options:\n- indexName(REQUIRED): Name of the the index to delete\n\n#### Delete Table\n```sh\nwillowDb.deleteTable(name=tableName)\n```\n\n##### Delete Table Options:\n- tableName(REQUIRED): Name of the the table to delete.\n## License\n\nMIT License\n\nCopyright (c) 2024 monkeytravel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A document database as a python module",
    "version": "0.1.10",
    "project_urls": {
        "Homepage": "https://github.com/monkeytravel/willowDb",
        "Source": "https://github.com/monkeytravel/willowDb"
    },
    "split_keywords": [
        "db",
        " documentdb",
        " nosql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64652dbd2495fda69b515a8147044f680c51becde5af21076dde82a84d224bba",
                "md5": "b87b2ae3e5bd1a4efca35a03a5c140cb",
                "sha256": "da9216cc10c8d54c37fe5ece62e488e068be136a8fc2664ba6f3355b9cc3a6f0"
            },
            "downloads": -1,
            "filename": "willowDb-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "b87b2ae3e5bd1a4efca35a03a5c140cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28794,
            "upload_time": "2024-03-30T21:50:16",
            "upload_time_iso_8601": "2024-03-30T21:50:16.050149Z",
            "url": "https://files.pythonhosted.org/packages/64/65/2dbd2495fda69b515a8147044f680c51becde5af21076dde82a84d224bba/willowDb-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-30 21:50:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "monkeytravel",
    "github_project": "willowDb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "willowdb"
}
        
Elapsed time: 0.21481s