PIbd-42_SSPR/test_db.py

33 lines
1.3 KiB
Python
Raw Permalink Normal View History

from clickhouse_tools import ClickHouseClient
from settings import settings
from pathlib import Path
import yaml
import utils
experiment_parameters = {
'outer_blades_count': 24.0,
'outer_blades_length': 70.0,
'outer_blades_angle': 60.0,
'middle_blades_count': 18.0,
'load': 400,
'recycling': 15,
}
with open('config.yaml', 'r') as config_file:
config = yaml.safe_load(config_file)
MAIN_PATH = config['paths']['main']
main_path = Path(MAIN_PATH)
geometry_path = (f"{experiment_parameters['outer_blades_count']}_{experiment_parameters['outer_blades_length']}_"
f"{experiment_parameters['outer_blades_angle']}_{experiment_parameters['middle_blades_count']}")
experiments_path = main_path / geometry_path / 'experiments'
load_path = experiments_path / str(experiment_parameters['load'])
recycling_path = load_path / str(experiment_parameters['recycling'])
table_csv = recycling_path / 'data_table.csv'
file_id = utils.calculate_hash(experiment_parameters)
clickhouse_client = ClickHouseClient("localhost", 8123, 'SuperService', 'UserMyHouse',
'NotWarningWord2')
clickhouse_client.save_csv_to_clickhouse(table_csv, file_id)