MongoDB User Stores for Python
Python Store Implementation for Data Sets in MongoDB
Usage
from frappymongodataset import DataStore
MONGO_URL = "mongodb://localhost:27017"
data_set_store = DataStore(mongo_url=MONGO_URL, mongo_db="myDatabase", collection_name="dataSets")
all_data_sets = data_set_store.get_all()
specific_data_sets = data_set_store.get_by_assignment("primaryKey")
The return objects from get methods are objects of type Data. Data provides an attribute payload, which returns
the type of payload represented by the data set. These types are:
DataImagePayloadfor images providing attributesimage_path,widthandheightDataJsonPayloadproviding the JSON payload with the attributedataDataTimeSeriesPayloadproviding attributescolumns,data(the rows),date_format,index_columnandcolumn_mapping
Examples
from frappymongodataset import DataTypes
images = data_set_store.get_by_type(DataTypes.IMAGE)
print(images[0].payload.path, images[0].payload.dimensions["width"], images[0].payload.dimensions["height"])
# prints out something like: "_data/5e846d104e61db060094ed14.jpg 1200 600"
nd_array = images[0].to_np_array() # will only work for IMAGE
time_series = data_set_store.get_by_type(DataTypes.TIME_SERIES)
print(time_series[0].payload.columns)
df = time_series[0].to_pd_data_frame() # will only work for TIME_SERIES
Methods
Base methods provided by pbu
get_all()- contrary to other stores, this will not return the payload of the individual data sets, but just the meta informationupdate_meta(data_id, meta_update)- updating meta information, needs to contain "label" and "assignments" updateget_by_type(data_type)- filters by the data setstypeattributeget_by_assignment_and_type(assignment_id, data_type)- filters by the data setstypeattribute and has to have an assignment for the groupassignment_idget_by_assignment(assignment_id)- just checks for anassignmentsto the group providedget_by_assignment_type(assignment_id, assignment_type)- not to be confused withget_by_assignment_and_type- this method will check for theassignment_idin theassignments, and within that (a list of identifier) assignment for the typeassignment_type
Metadata
Release files for frappymongodataset 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| frappymongodataset-1.3.3.tar.gz | 6.8 kB | Without provenance | Details for frappymongodataset-1.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| frappymongodataset-1.3.3-py3-none-any.whl | Python 3 | none | any | Details for frappymongodataset-1.3.3-py3-none-any.whl |
Total release size: 17.8 kB
Release files / frappymongodataset-1.3.3.tar.gz
| Download URL | frappymongodataset-1.3.3.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dff6d0b98da49b27d07ddfef0b1cbd2150e8867be86a99359b82a91dc218abd
|
|
BLAKE2b-256 checksum How to use checksums |
52707e6013684166ee3f91e866a86cf0ca44df819ffa9f4a4f37a1a199754f70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.12
|
Release files / frappymongodataset-1.3.3-py3-none-any.whl
| Download URL | frappymongodataset-1.3.3-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b839191486221da87b1a483a50a73e2b9c4ae1319e16a84379452bb1dcdcc29e
|
|
BLAKE2b-256 checksum How to use checksums |
c533b5412c90bf1b392871855cd335dd58ff05d1b559dacc4dbe094d7446dbf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.12
|
Security for frappymongodataset 1.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.