def store_main_model_in_db(model, scaler_X, scaler_y): database = Database() database.create_table(CREATE_MODEL_QUERY) database.drop_table(DELETE_ALL_MODELS_QUERY) pickled_tuple = ModelStorage.__get_tuple_pickled( (model, scaler_X, scaler_y)) database.insert_data(INSERT_MODEL_QUERY, pickled_tuple) database.close_connection()
def _drop_table(self, query: str): try: database = Database() database.drop_table(query) self._response = self._build_response(data=jsonify( {"message": "Successful DELETE request"}), status_code=200) except: self._response = self._build_response(data=jsonify( {"message": "Internal server error"}), status_code=500) finally: database.close_connection()