local_simple_database package¶
Submodules¶
local_simple_database.class_dict_database_handler module¶
Module with class to handle dict databases
-
class
DictDatabaseHandler
(local_dict_database_obj, str_db_name)[source]¶ Bases:
object
This class was built to handle one DICT DataBase
…
-
self.
local_dict_database_obj
¶ Handler of all DICT database-s in the folder
Type: object of class: LocalDictDatabase
-
self.
str_db_name
¶ Name of DataBase which to use
Type: str
-
self.
default_value
¶ Value to use if key in database is not found
Type: object
-
local_simple_database.class_local_dict_database module¶
module with main class to process Local Databases with dictionaries
-
class
LocalDictDatabase
(str_path_database_dir='.', float_max_seconds_per_file_operation=0.01, default_value=None, str_datetime_template_for_rolling='')[source]¶ Bases:
local_simple_database.virtual_class_all_local_databases.VirtualAnyLocalDatabase
This class was built to handle dictionary DataBase-s
…
- self.str_path_main_database_dir : str
- Path to main folder with DataBase-s
- self.str_datetime_template_for_rolling : str
- Datetime template for folder name if to use rolling
- self.list_supported_types : list
- DataBase Types with which this local database can work
- self.dict_file_lock_by_fila_path : dict
- {file_path_1: FileLock object, …}
- self.float_max_seconds_per_file_operation : float
- Seconds per file operation, need it for multiprocessing safety
-
self.
default_value
¶ Value to use if key in database is not found
Type: object
-
self.
dict_db_handler_by_str_db_name
¶ {database_name: handler ( special object to handle access to one DB)}
Type: dict
local_simple_database.class_local_simple_database module¶
Module with class to handle all simple local databases
-
class
LocalSimpleDatabase
(str_path_database_dir='.', float_max_seconds_per_file_operation=0.01, str_datetime_template_for_rolling='')[source]¶ Bases:
local_simple_database.virtual_class_all_local_databases.VirtualAnyLocalDatabase
This class was built to handle all one value DataBase-s
…
- self.str_path_main_database_dir : str
- Path to main folder with DataBase-s
- self.str_datetime_template_for_rolling : str
- Datetime template for folder name if to use rolling
- self.list_supported_types : list
- DataBase Types with which this local database can work
- self.dict_file_lock_by_fila_path : dict
- {file_path_1: FileLock object, …}
- self.float_max_seconds_per_file_operation : float
- Seconds per file operation, need it for multiprocessing safety
-
self.
dict_str_db_type_by_str_db_name
¶ {database_1_name: str_value_type, …}
Type: dict
-
self.
dict_list_db_allowed_types_by_str_db_name
¶ {database_1_name: list_allowed_types_for_set_value, …}
Type: dict
-
self.
dict_func_db_getter_by_str_db_name
¶ {database_1_name: func_to_convert_str_to_value, …}
Type: dict
-
self.
dict_func_db_setter_by_str_db_name
¶ {database_1_name: func_to_convert_value_to_str, …}
Type: dict
local_simple_database.virtual_class_all_local_databases module¶
Module with virtual class to contain all common methods for any database
-
class
VirtualAnyLocalDatabase
(str_path_database_dir='.', float_max_seconds_per_file_operation=0.01, str_datetime_template_for_rolling='')[source]¶ Bases:
object
This is virtual class to handle all needs for all child DataBases
…
-
self.
str_path_main_database_dir
¶ Path to main folder with DataBase-s
Type: str
-
self.
str_datetime_template_for_rolling
¶ Datetime template for folder name if to use rolling
Type: str
-
self.
list_supported_types
¶ DataBase Types with which this local database can work
Type: list
-
self.
dict_file_lock_by_file_path
¶ {file_path_1: FileLock object, …}
Type: dict
-
self.
float_max_seconds_per_file_operation
¶ Seconds per file operation, need it for multiprocessing safety
Type: float
-
define_type_of_db_by_name
(str_db_name)[source]¶ Define type on database if it name follows given template type_name
Parameters: str_db_name (str) – Name of asked database
-
get_dict_every_DB_by_datetime
()[source]¶ Getting {date_1: dict_results_of_all_DBs_for_date_1, date_2: …}
-
get_dir_names_of_all_dirs_with_rolling_DBs
()[source]¶ Getting names of dir-s with rolling results for DataBase
-
get_file_path_with_db_file
(str_db_name)[source]¶ Get path to file with DataBase
Parameters: str_db_name (str) – Name of asked database
-
get_list_names_of_all_files_with_dbs_in_dir
()[source]¶ Getting all names of databases in DB-handler folder
-
get_one_db_data_daily
(str_db_name, value_to_use_if_db_not_found=None)[source]¶ Getting {date_1: value_1, date_2: value_2, …} for one database
Parameters: - str_db_name (str) – Name of DataBase which to use
- value_to_use_if_db_not_found (object) – value to set if results for some days not found
-
Module contents¶
-
class
LocalSimpleDatabase
(str_path_database_dir='.', float_max_seconds_per_file_operation=0.01, str_datetime_template_for_rolling='')[source]¶ Bases:
local_simple_database.virtual_class_all_local_databases.VirtualAnyLocalDatabase
This class was built to handle all one value DataBase-s
…
- self.str_path_main_database_dir : str
- Path to main folder with DataBase-s
- self.str_datetime_template_for_rolling : str
- Datetime template for folder name if to use rolling
- self.list_supported_types : list
- DataBase Types with which this local database can work
- self.dict_file_lock_by_fila_path : dict
- {file_path_1: FileLock object, …}
- self.float_max_seconds_per_file_operation : float
- Seconds per file operation, need it for multiprocessing safety
-
self.
dict_str_db_type_by_str_db_name
¶ {database_1_name: str_value_type, …}
Type: dict
-
self.
dict_list_db_allowed_types_by_str_db_name
¶ {database_1_name: list_allowed_types_for_set_value, …}
Type: dict
-
self.
dict_func_db_getter_by_str_db_name
¶ {database_1_name: func_to_convert_str_to_value, …}
Type: dict
-
self.
dict_func_db_setter_by_str_db_name
¶ {database_1_name: func_to_convert_value_to_str, …}
Type: dict
-
class
LocalDictDatabase
(str_path_database_dir='.', float_max_seconds_per_file_operation=0.01, default_value=None, str_datetime_template_for_rolling='')[source]¶ Bases:
local_simple_database.virtual_class_all_local_databases.VirtualAnyLocalDatabase
This class was built to handle dictionary DataBase-s
…
- self.str_path_main_database_dir : str
- Path to main folder with DataBase-s
- self.str_datetime_template_for_rolling : str
- Datetime template for folder name if to use rolling
- self.list_supported_types : list
- DataBase Types with which this local database can work
- self.dict_file_lock_by_fila_path : dict
- {file_path_1: FileLock object, …}
- self.float_max_seconds_per_file_operation : float
- Seconds per file operation, need it for multiprocessing safety
-
self.
default_value
¶ Value to use if key in database is not found
Type: object
-
self.
dict_db_handler_by_str_db_name
¶ {database_name: handler ( special object to handle access to one DB)}
Type: dict