-
-
- def import_file_by_path(
- path: str,
- force: bool = False,
- data_import: bool = False,
- pre_process=None,
- ignore_version: bool = None,
- reset_permissions: bool = False,
- ):
- """Import file from the given path
-
- Some conditions decide if a file should be imported or not.
- Evaluation takes place in the order they are mentioned below.
-
- - Check if `force` is true. Import the file. If not, move ahead.
- - Get `db_modified_timestamp`(value of the modified field in the database for the file).
- If the return is `none,` this file doesn't exist in the DB, so Import the file. If not, move ahead.
- - Check if there is a hash in DB for that file. If there is, Calculate the Hash of the file to import and compare it with the one in DB if they are not equal.
- Import the file. If Hash doesn't exist, move ahead.
- - Check if `db_modified_timestamp` is older than the timestamp in the file; if it is, we import the file.