NHyDBrun4
R
u
v
Version of 1
lane
NLOverview

NHyDB

NHyDB is the complete engine of the family: a native core in Rust, used from Python. Every value lives at a mathematical address (R, u, v, lane) – how the data is distributed across these addresses is up to you.

Storing

Records with a fixed, typed field structure and freely written single cells can be mixed, on both sides NL and NR and in any number of realms. Overwriting and deleting work for single cells, whole areas and whole records; the most recently written value always applies. Read more: Records and cells.

Layouts and MATH_MAP

Layouts are predefined storage forms: CLASSIC, COLUMN, PACKED and CUSTOM for your own rule in Python. With MATH_MAP, values are written by formula to computed positions – in a safeguarded calculation environment with limits. Read more: Layouts · MATH_MAP.

Searching and querying

Indexes find exact values, value ranges, words and parts of words; full-text search sorts by relevance. The QueryEngine chooses an efficient path for every query, and with NHySQL you read data in an SQL-like language. Read more: Indexes and search · Queries.

Python and NumPy

For everyday work there are single operations, for large amounts of data the NumPy interface: whole columns in one call, with the loops running in Rust. Read more: Python and NumPy.

From Rust, too

The core of NHyDB is a pure Rust library (nhydb-core) and can also be embedded directly in Rust programs without Python – which is exactly what NhyFlow does. There is no package on crates.io for this yet; you include the source code from the GitHub repository. So far, the documented interface is the Python interface. Would you like to use NHyDB the way NhyFlow does – as a pure Rust database in your own program? Then feel free to email achim.meissner@nhydb.de, and we can talk about your project.

Reliable and protected

Changes are committed explicitly; after a crash the last committed state applies. Checking, repairing and compacting are part of it. How the data is structured is stored encrypted in a separate file – without the matching key the database will not open. Read more: Data safety · Protection and operation.

Reading by the number N

Every cell can also be reached by its number N. Here N of Marburg’s postal code is computed and the cell is read with it:

import nhydb

with nhydb.create("places.nhydb") as db:
    db.create_realm(1, "main")
    db.create_shape(1, 1, "place", [{"v": 1, "name": "name", "type": "utf8"},
                                    {"v": 2, "name": "postal_code", "type": "utf8"}])
    db.create_classic_layout(1, 1, "places", shape_id=1)
    db.put_dense_batch(1, 1, [["Giessen", "35390"], ["Marburg", "35037"]], shape_id=1)

with nhydb.open("places.nhydb", readonly=True) as db:
    n = nhydb.dynadron_n(1, 2, 2, "NL")        # realm 1, u = 2, v = 2 (field postal_code), side NL
    a = nhydb.n_to_dynadron_address(n)         # and back to the address
    print(n, a["u"], a["v"])
    print(db.get_n_cell(n)["value"], db.get_n_record(n)["data"])

Output:

14 2 2
35037 {'name': 'Marburg', 'postal_code': '35037'}
# NHyDB NHyDB is the complete engine of the family: a native core in Rust, used from Python. Every value lives at a mathematical address (R, u, v, lane) – how the data is distributed across these addresses is up to you. ## Storing Records with a fixed, typed field structure and freely written single cells can be mixed, on both sides NL and NR and in any number of realms. Overwriting and deleting work for single cells, whole areas and whole records; the most recently written value always applies. Read more: [Records and cells](/en/records-and-cells/). ## Layouts and MATH_MAP Layouts are predefined storage forms: CLASSIC, COLUMN, PACKED and CUSTOM for your own rule in Python. With MATH_MAP, values are written by formula to computed positions – in a safeguarded calculation environment with limits. Read more: [Layouts](/en/layouts/) · [MATH_MAP](/en/math-map/). ## Searching and querying Indexes find exact values, value ranges, words and parts of words; full-text search sorts by relevance. The QueryEngine chooses an efficient path for every query, and with NHySQL you read data in an SQL-like language. Read more: [Indexes and search](/en/indexes-and-search/) · [Queries](/en/queries/). ## Python and NumPy For everyday work there are single operations, for large amounts of data the NumPy interface: whole columns in one call, with the loops running in Rust. Read more: [Python and NumPy](/en/python-and-numpy/). ## From Rust, too The core of NHyDB is a pure Rust library (`nhydb-core`) and can also be embedded directly in Rust programs without Python – which is exactly what NhyFlow does. There is no package on crates.io for this yet; you include the source code from the GitHub repository. So far, the documented interface is the Python interface. Would you like to use NHyDB the way NhyFlow does – as a pure Rust database in your own program? Then feel free to email [achim.meissner@nhydb.de](mailto:achim.meissner@nhydb.de), and we can talk about your project. ## Reliable and protected Changes are committed explicitly; after a crash the last committed state applies. Checking, repairing and compacting are part of it. How the data is structured is stored encrypted in a separate file – without the matching key the database will not open. Read more: [Data safety](/en/data-safety/) · [Protection and operation](/en/protection-and-operation/). ## Reading by the number N Every cell can also be reached by its number N. Here N of Marburg's postal code is computed and the cell is read with it: ```pythonimport nhydb with nhydb.create("places.nhydb") as db: db.create_realm(1, "main") db.create_shape(1, 1, "place", [{"v": 1, "name": "name", "type": "utf8"}, {"v": 2, "name": "postal_code", "type": "utf8"}]) db.create_classic_layout(1, 1, "places", shape_id=1) db.put_dense_batch(1, 1, [["Giessen", "35390"], ["Marburg", "35037"]], shape_id=1) with nhydb.open("places.nhydb", readonly=True) as db: n = nhydb.dynadron_n(1, 2, 2, "NL") # realm 1, u = 2, v = 2 (field postal_code), side NL a = nhydb.n_to_dynadron_address(n) # and back to the address print(n, a["u"], a["v"]) print(db.get_n_cell(n)["value"], db.get_n_record(n)["data"])``` Output: ```text14 2 235037 {'name': 'Marburg', 'postal_code': '35037'}```