DbBaseClass
- class DbBaseClass(user_config_path='.user_config.ini')[source]
Baseclass for data interactions.
- Parameters
user_config_path (str, optional) – Path to the user specific config, which will overwrite default settings. by default “.user_config.ini”
Attributes Summary
default_config_path
Methods Summary
Calculate hashvalues for files.
Remove rows where the session work was less than 1min.
Helpermethod for mocking of datetime.datetime.now() in unittests.
Return datetime.now as pd.Timestamp.
Download the db_file to db_path_online from the SFTP server.
Load the config files and sets all necessary properties.
Read in the db file if it exists or creates a new one.
Merge local db with remote db.
Push the db_file from db_path_offline to the SFTP server.
Methods Documentation
- calc_file_hashes() DataFrame [source]
Calculate hashvalues for files.
- Returns
Dataframe with file hashes.
- Return type
pd.DataFrame
- get_datetime_now() datetime [source]
Helpermethod for mocking of datetime.datetime.now() in unittests.
- Returns
datetime.now()
- Return type
datetime.datetime
- get_pandas_now() Timestamp [source]
Return datetime.now as pd.Timestamp.
- Returns
current time as timestamp: pd.Timestamp
- Return type
pd.Timestamp
- get_remote_db() bool [source]
Download the db_file to db_path_online from the SFTP server.
This uses the values specified at [“login”][“db_path”] in the config file.
- Returns
Whether database retrieval succeeded or not.
- Return type
bool
- load_db(db_path: str) DataFrame [source]
Read in the db file if it exists or creates a new one.
- Parameters
db_path (str) – path to the db_file on the SFTP server
- Returns
Loaded database.
- Return type
pd.Dataframe