Skip to main content

NoSQL-Schema-Check

pip install NoSQL_Schema_Check

from nosql_schema_check.model import Model

class Model_Class(Model):

    Schema={field: value}

    Validations={field: function -> True/False}

    Default={field: function -> Default value}

    Required=[keys, ...]

  Optional variable -

    collection=Collection object.

Model_Class.generate()


Schema = {

    "key": 'type', -> change 'type' with type string.

    "key1": {key: value, ...},

    "key2": ('list', 'type') -> change 'type' with type string. ([value1, value2, ...])

}


Validations = {

    "key": validate function for value,

    ...

    validation for 'type' only.

}


Default = {

    "key": function that returns default value,

    ...

    default value for field only.

}


functions -

   Model_Class.check_data

   Model_Class.print_schema

   Model_Class.compare_records

   Model_Class.compare_record

   Model_Class.update_records

   Model_Class.update_record

   Model_Class.collection


Example:

class Test(Model):
    Schema={
        "integer": "int",
        "string": "str",
        "list": ('list', "int"),
        "dict": {
            "key": "int", 
            "key1": ('list', {
                "integer": "int", 
                "list": ('list', 'str')
            })
        },
        "list_in_list": ('list', ('list', "str")),
        "dict_in_dict": {
            "a": 'int',
            "b": {
                "a": 'str'
            }
        }
    }
    Validations={
        "integer": lambda i:True if i < 10 else print("Integer must be less than 10."),
        "string": lambda s: len(s) < 10,
        "list": (lambda l: len(l) < 4, lambda i: i < 10),
        "dict":(lambda d: len(d) < 3,
            {
                "key": lambda i: i < 10,
                "key1": (lambda l: len(l) < 2,)
            }),
        "list_in_list": lambda s: len(s) < 10,
        "dict_in_dict": {
            "b": {
                "a": lambda s: len(s) < 20,
            },
            "a":lambda i: i < 20
        }
    }
    Required=["integer", "list", ('dict', ["key", ("key1", ["integer"])])]
    Default={"string":lambda:"Default_String"[:9]}
    name="test"

Test.generate()

try:
    data = Test.compare_record({"integer": 9, "list": [2,3,5], "dict": {"key": 9, "key1": [{"integer": 20, "list": ["asdd", "sfd"]}]}, "list_in_list": [["string1", "string2", "string3"]], "Something": "Extra_Thing"}, True)
    print(data)
    data.pop("Something")
    print(Test.compare_records([data]))
    print(Test.update_record({"integer": 5, "list": [10,20,30]}, data))
    print(Test.update_records([{"integer": 5, "list": [10,20,30]},], [data,]))
except:
    pass

Release files for NoSQL-Schema-Check 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for NoSQL-Schema-Check 0.0.8
File Size Uploaded
nosql_schema_check-0.0.8.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for NoSQL-Schema-Check 0.0.8
File Interpreter ABI Platform
nosql_schema_check-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / nosql_schema_check-0.0.8.tar.gz

Download URL nosql_schema_check-0.0.8.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9792ee3922c2c7ed99c695bb9856e9c1a79d22742179965632d2cbadafbacedf
BLAKE2b-256 checksum
How to use checksums
69d5dac0e82561cfae4a4e07e60c4afa94597ed03911d41711beb2d48f03c3f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / nosql_schema_check-0.0.8-py3-none-any.whl

Download URL nosql_schema_check-0.0.8-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0e395dd7870c1a769e037c67a35a59a393e555a9ff7786e4489022d1508b83c
BLAKE2b-256 checksum
How to use checksums
e19077eeb423e092bae0e8c09ebd13bf52d28be24bec636e7373775170dbe489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page