Skip to main content
# 3db - three DB

[![Build Status](https://travis-ci.org/EvgenyAK/3db.svg?branch=master)](https://travis-ci.org/EvgenyAK/3db.svg?branch=master)

ThreeDB is a lightweight database optimized for data storage used testing. [DDT](https://en.wikipedia.org/wiki/Data-driven_testing).

## Usage

```
TestData/
10001_A/
data_1.txt
etalon_1.txt
10002_B/
data_1.txt
etalon_1.txt
10003_A_B/
data_A_1.txt
etalon_A_1.txt
data_B_1.txt
data_B_1.txt
```

```python
import threedb


db = threedb.connect("TestData/")
items = db.search()
print(items)

>>> {'ref': './10001_A', 'etalon_1_txt': <threedb.storage.DataItem object at 0x7f7de4563b38>, 'tags': [], 'data_1_txt': <threedb.storage.DataItem object at 0x7f7de4563b70>, 'index': '10001_A'}
>>> {'ref': './10002_A_B', 'etalon_1_txt': <threedb.storage.DataItem object at 0x7f7de4563ba8>, 'tags': [], 'data_1_txt': <threedb.storage.DataItem object at 0x7f7de4563be0>, 'index': '10002_A_B'}
>>> {'ref': './10002_B', 'etalon_1_txt': <threedb.storage.DataItem object at 0x7f7de4563c50>, 'tags': [], 'data_1_txt': <threedb.storage.DataItem object at 0x7f7de4563c88>, 'index': '10002_B'}

items = db.search(*("10001_A",))
print(items)

>>> {'ref': './10001_A', 'etalon_1_txt': <threedb.storage.DataItem object at 0x7f7de4563b38>, 'tags': [], 'data_1_txt': <threedb.storage.DataItem object at 0x7f7de4563b70>, 'index': '10001_A'}

first = item[0]["etalon_1_txt"]
print(first.text)

>>> {"name": "Neo"}

print(first.json())

>> {
"name": "Neo"
}
```


## Database schema

Used to describe the schema of a database.

```json
'schema': {
'input_data': {
'match': ['data.*']
},
'gold_etalon': {
'match': ['etalon.*'],
}
}
```

```python

db = threedb.connect("TestData/")
items = db.search(*("10001_A",))
print(items)

{'tags': [], 'index': '10001_A', 'ref': './10001_A', 'gold_etalon': <threedb.storage.DataItem object at 0x7fbfaff4bc88>, 'input_data': <threedb.storage.DataItem object at 0x7fbfaff4bf28>}


```
## Meta-data file

```
TestData/
10001_A/
metadata.yaml # tags: - serviceA

data_1.txt
etalon_1.txt
10002_B/
data_1.txt
etalon_1.txt
10003_A_B/
data_A_1.txt
etalon_A_1.txt
data_B_1.txt
data_B_1.txt
```

```python
db = threedb.connect("TestData/")
items = db.search(*("serviceA",))
print(items)

>>> {'ref': './10001_A', 'etalon_1_txt': <threedb.storage.DataItem object at 0x7f7de4563b38>, 'tags': ['serviceA'], 'data_1_txt': <threedb.storage.DataItem object at 0x7f7de4563b70>, 'index': '10001_A'}
```

Metadata

Release files for threedb 1.1

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

Source distribution (sdist)

Source distribution for threedb 1.1
File Size Uploaded
threedb-1.1.tar.gz 3.7 kB Details

Release files / threedb-1.1.tar.gz

Download URL threedb-1.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2e46bfc6aef3b67e79bbda8d5061f65cbc7e427a38bfa8dde18d959a2f7fd3ad
BLAKE2b-256 checksum
How to use checksums
8745e8ca5768f1cb0a0e1604d24ac5b80c87bbbf1b143dfb82466eaee5d9441b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file

1.0

1 release file

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