rocket-store-python
Using the filesystem as a searchable database.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.0%) to scientific vocabulary
Keywords
Repository
Using the filesystem as a searchable database.
Basic Info
Statistics
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 13
Topics
Metadata Files
README.md
Rocket-Store Python
Using the filesystem as a searchable database.
Rocketstore is a Python library for data storage. It provides an interface for storing and retrieving data in various formats.
ORIGINAL / NODE VERSION: https://github.com/Paragi/rocket-store/
You can download from PyPi repository: https://pypi.org/project/Rocket-Store/
Basic terminology
Rocket-Store was made to replace a more complex database, in a setting that required a low footprint and high performance.
Rocket-Store is intended to store and retrieve records/documents, organized in collections, using a key.
Terms used: * Collection: name of a collections of records. (Like an SQL table) * Record: the data store. (Like an SQL row) * Data storage area: area/directory where collections are stored. (Like SQL data base) * Key: every record has exactly one unique key, which is the same as a file name (same restrictions) and the same wildcards used in searches.
Compare Rocket-Store, SQL and file system terms:
| Rocket-Store | SQL| File system | |---|---|--- | storage area | database | data directory root | | collection | table | directory | | key | key | file name | | record | row | file |
Features
- Support for file locking.
- Support for creating data storage directories.
- Support for adding auto incrementing sequences and GUIDs to keys.
Usage
To use Rocketstore, you must first import the library:
```python from Rocketstore import Rocketstore
rs = Rocketstore() ```
usage of constants: ```python
method 1:
rs = Rocketstore() rs.post(..., rs.FORMATJSON)
or
rs.post(..., Rocketstore.FORMATJSON)
```
Post
```python rs.post(collection="deletefodders1", key="1", record={"some":"json input"}, flags=Rocketstore.FORMAT_JSON)
or
rs.post("deletefodders1", "1", {"some":"json input"}, Rocketstore.FORMAT_JSON) ```
Stores a record in a collection identified by a unique key
Collection name to contain the records.
Key uniquely identifying the record
No path separators or wildcards etc. are allowed in collection names and keys. Illigal charakters are silently striped off.
Content Data input to store
Options * ADDAUTOINC: Add an auto incremented sequence to the beginning of the key * _ADDGUID: Add a Globally Unique IDentifier to the key
Returns an associative array containing the result of the operation: * count : number of records affected (1 on succes) * key: string containing the actual key used
If the key already exists, the record will be replaced.
If no key is given, an auto-incremented sequence is used as key.
If the function fails for any reason, an error is thrown.
Get
Find and retrieve records, in a collection.
```python rs.get(collection="delete_fodders1")
or
rs.get("delete_fodders1")
Get wildcard
rs.get("delete_*")
Get wildcard in collection
rs.get("*")
Get wildcard in key (see sample in Samples/queries.py)
rs.get("delete_fodders1", "*")
Get only auto incremented rows (see sample in Samples/queries.py)
rs.get("delete_fodders1", "?")
get only keys
rs.get("deletefodders1", "*", Rocketstore.KEYS) ```
Collection to search. If no collection name is given, get will return a list of data base assets: collections and sequences etc.
Key to search for. Can be mixed with wildcards '*' and '?'. An undefined or empty key is the equivalent of '*'
Options: * ORDER : Results returned are ordered alphabetically ascending. * _ORDERDESC : Results returned are ordered alphabetically descending. * _KEYS : Return keys only (no records) * _COUNT : Return record count only
Return an array of * count : number of records affected * key : array of keys * result : array of records
NB: wildcards are very expensive on large datasets with most filesystems. (on a regular PC with +10^7 records in the collection, it might take up to a second to retreive one record, whereas one might retrieve up to 100.000 records with an exact key match)
Delete
Delete one or more records, whos key match.
```python
Delete database
rs.delete()
Delete collection with content
rs.delete("delete_fodders1")
Delete wild collection
rs.delete("delete_*")
Delete exact key
rs.delete("delete_fodders1", "1")
```
Collection to search. If no collection is given, THE WHOLE DATA BASE IS DELETED!
Key to search for. Can be mixed with wildcards '*' and '?'. If no key is given, THE ENTIRE COLLECTION INCLUDING SEQUENCES IS DELETED!
Return an array of * count : number of records or collections affected
Options
Can be called at any time to change the configuration values of the initialized instance
Options: * datastoragearea: The directory where the database resides. The default is to use a subdirectory to the temporary directory provided by the operating system. If that doesn't work, the DOCUMENTROOT directory is used. * dataformat: Specify which format the records are stored in. Values are: FORMATNATIVE - default. and RSFORMATJSON - Use JSON data format.
```python rs.options(dataformat=Rocketstore.FORMAT_JSON)
or
rs.options(**{ "dataformat": Rocketstore.FORMAT_JSON, ... }) ```
Inserting with Globally Unique IDentifier key
Another option is to add a GUID to the key. The GUID is a combination of a timestamp and a random sequence, formatet in accordance to RFC 4122 (Valid but slightly less random)
If ID's are generated more than 1 millisecond apart, they are 100% unique. If two ID's are generated at shorter intervals, the likelyhod of collission is up to 1 of 10^15.
Contribute
Contributions are welcome. Please open an issue to discuss what you would like to change.
Docs:
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
- https://realpython.com/pypi-publish-python-package/
Publish to Pypi
Local:
shell
python -m pip install build twine
python3 -m build
twine check dist/*
twine upload dist/*
Live: No need do nothing GitHub have Workflow action its publish auto
Local dev
In root folder run create virtual env virtualenv ./venv && . ./venv/bin/activate
and run pip install -e .
Star History
Owner
- Name: Anton Sychev
- Login: klich3
- Kind: user
- Location: Barcelona
- Company: @Sychev
- Website: https://sychev.xyz
- Twitter: too_klich3
- Repositories: 35
- Profile: https://github.com/klich3
FullStack developer passionate about decentralized web tech, AI, Web 2.0, FrontEnd/BackEnd, databases, and system optimization. Focused on R&D.
Citation (CITATION.cff)
cff-version: 1.2.0
title: Rocket-Store
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Anton
family-names: Sychev
email: anton@sychev.xyz
repository-code: "https://github.com/klich3/rocket-store-python"
abstract: Using the filesystem as a searchable database. Ported from the original Rocket-Store (NodeJs).
keywords:
- storage
- database
- filestorage
- file
- rocket
license: MIT
version: 0.0.10
GitHub Events
Total
Last Year
Committers
Last synced: 12 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Anton Sychev | a****n@s****z | 45 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- klich3 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 18 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 10
- Total maintainers: 1
pypi.org: rocket-store
Using the filesystem as a searchable database.
- Homepage: https://github.com/klich3/rocket-store-python
- Documentation: https://rocket-store.readthedocs.io/
- License: Rocket Store A very simple and yet powerful file storage. Copyright (c) Paragi 2017, Simon Riget. 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.
-
Latest release: 0.0.10
published about 2 years ago
Rankings
Maintainers (1)
Dependencies
- build *
- twine *