light weight package for populating mongo database and query it with energy data
Project description
Local Database
Description:
Popluate and query local mongo server with energy api data
Populate Database Section
Sample Usage
Batch insertion:
create_db = CreateDb(db_name='example_db')
create_db.batch_insert('folder_path')
Single insert:
create = CreateDb(db_name='example_db')
create.single_insert(time_collection='time_(1_sec|1_min|15_min)', data_file_dir='data folder path', meta_file_dir='metadata folder path')
Query Database Section
Sample Usage
Query with filter
query = QueryDb(db_name='example_db')
query_param = ['nest', 'grid', 'solar', 'clotheswasher1', 'dishwasher1']
data, id_list = query.query_df(query_param, 'time_15_min', db_op='OR', city=['all'])
try:
data = QueryDb.filter_by(data, dataid='6139', city='austin')
except Exception as e:
print(e)
Query with dictionary parameter
query = QueryDb(db_name='example_db')
query_param = ['air1', 'nest', {'first_floor_square_footage': 2148}]
data, id_list = query.query_df(
query_param,
time_collection='time_15_min',
db_op='AND',
city=['all']
first_floor_sqft_tol=0
)
Test scripts
Must have test json files to implement this.
note: commands must be implemented from command line ./local_db directory
python -m unittest tester.TestCreateDbClass.test_db_server
python -m unittest tester.TestCreateDbClass.test_batch_insert
python -m unittest tester.TestCreateDbClass.test_query_error_check
python -m unittest tester.TestCreateDbClass.test_query_empty
python -m unittest tester.TestCreateDbClass.test_query_db_op
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
local_db-lasdot-0.0.1.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file local_db-lasdot-0.0.1.tar.gz
.
File metadata
- Download URL: local_db-lasdot-0.0.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c19739d07c668d4b3a32ccac9445f20302fb6a379cf4bcc94d5b000cd9146f1 |
|
MD5 | 269c18225db9c2c13f74f2ab1d12ff23 |
|
BLAKE2b-256 | 25bfdd312c5d92b24bce4aecb46199198ccf824df42c04fae86f89ca6c544177 |
File details
Details for the file local_db_lasdot-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: local_db_lasdot-0.0.1-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d3176f2f6695bcc0843c864e451fda0bd0e8bd3624cfd97601cfd3c7c3a9568 |
|
MD5 | 189882ee325d032d8b11adbf98421d5e |
|
BLAKE2b-256 | 792d7a616bed40654fb3aef60126a7db46c29e15d3c7011b183ca9163a02903c |