Skip to main content

ThreeDB is a lightweight database optimized for data storage used testing

Project description

# 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'}
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

threedb-1.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file threedb-1.1.tar.gz.

File metadata

  • Download URL: threedb-1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for threedb-1.1.tar.gz
Algorithm Hash digest
SHA256 2e46bfc6aef3b67e79bbda8d5061f65cbc7e427a38bfa8dde18d959a2f7fd3ad
MD5 d127910578216b2e7e751bd3766ad509
BLAKE2b-256 8745e8ca5768f1cb0a0e1604d24ac5b80c87bbbf1b143dfb82466eaee5d9441b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page